fix(cli): correct ajv import to resolve TypeScript build error#242
Open
fix(cli): correct ajv import to resolve TypeScript build error#242
Conversation
the ajv import used default import with new Ajv.default() which caused
TypeScript errors after dependency resolution. switching to named import
{ Ajv } and removing the spurious .default call fixes compilation.
bumps ajv to 8.20.0 which ships with a compiled dist directory needed
for correct type resolution in the NodeNext module context.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a TypeScript compilation error in
CLI/src/core/stages.tscaused by an incorrect AJV import pattern.Before:
After:
Why
The default import
import Ajv from 'ajv'combined withnew Ajv.default()caused two TypeScript errors depending on which version of AJV types TypeScript resolved:Property 'default' does not exist on type— when resolving against the root workspacenode_modules/ajv(v6, which has nostrictoption and no.defaultsubclass)This expression is not constructable— when resolving againstCLI/node_modules/ajv(v8 withdist/built)npm run type-checkexited non-zero before this fix; it exits 0 after.The named import
{ Ajv }correctly targets the exported class in AJV v8's type declarations (export declare class Ajv), removing both errors.Also bumps
ajvto^8.20.0(latest patch) which ships with a compileddist/directory, ensuring TypeScript resolves AJV v8 types rather than hoisting to the root workspace's AJV v6.Tested
npm run type-checkpasses (exit 0)npm run lintoutput unchanged (same 53 warnings, 0 errors)🤖 Generated with Claude Code