Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core): enable strict null checks #1878

Merged

Conversation

bentatum
Copy link
Contributor

@bentatum bentatum commented Jan 5, 2025

Relates to

Type safety

Risks

Low

Background

What does this PR do?

Added type safety to evaluators in packages/core/src/runtime.ts to prevent crashes when parseJsonArrayFromText returns null. The fix uses evaluators?.includes to handle potential null values. Since strictNullChecks is disabled, similar issues likely exist elsewhere. I enabled strictNullChecks in the core package and kept changes minimal, focusing on the core runtime. Downstream TypeScript errors were addressed with ts-expect-error pragmas. This approach facilitates the incremental adoption of stricter type safety.

What kind of change is this?

Typescript related

Why are we doing this? Any context or related work?

The app crashes occasionally when parseJsonArrayFromText returns null in core runtime logic.

Documentation changes needed?

No

Testing

Integration tests should catch any issues. The only real change here is a null key check on evaluators in the evaluator handler loop.

Where should a reviewer start?

Start the app, make some prompts, make sure normal prompts work as expected.

Detailed testing steps

@bentatum bentatum changed the title chore: enable strict null checks chore(core): enable strict null checks Jan 5, 2025
@shakkernerd shakkernerd merged commit fff2040 into elizaOS:develop Jan 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants