fix(cli-internal): pin typescript in generated Gen2 package.json#14925
Draft
sarayev wants to merge 2 commits into
Draft
fix(cli-internal): pin typescript in generated Gen2 package.json#14925sarayev wants to merge 2 commits into
sarayev wants to merge 2 commits into
Conversation
The gen2-migration generate command produced a root package.json with no typescript dependency, so migrated projects inherited whatever TypeScript version was already present. Older TypeScript (<5.0) cannot parse the const type parameters used by @aws-amplify/data-schema's .d.ts files, producing TS1139/TS1005 syntax errors during the type-check step (these are parser-level errors that skipLibCheck does not suppress). Pin typescript to ^5.4.0 in GEN2_DEV_DEPENDENCIES. maxVersion() keeps the higher of existing vs incoming, so an already-newer pin is preserved.
…ures Align the generated Gen2 typescript pin with the version already used by the migration-app fixtures (~5.9.3) for consistency, and regenerate the generate.test.ts golden snapshots. Only the typescript devDependency changes in the affected fixtures (backend-only, discussions, mood-board).
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.
Problem
The
gen2-migration generatecommand produces a rootpackage.jsonwith notypescriptdependency, so migrated projects inherit whatever TypeScript happens to be present. Older TypeScript (<5.0) cannot parse theconsttype parameters in@aws-amplify/data-schema's.d.tsfiles, producing TS1139/TS1005 syntax errors during the type-check step. These are parser-level errors thatskipLibCheckdoes not suppress.Fix
Add
typescript: ^5.4.0toGEN2_DEV_DEPENDENCIES.maxVersion()keeps the higher of existing vs incoming, so an already-newer pin is preserved.Test
Added a case to
package.json.generator.test.tsasserting the generated devDependencies pintypescriptat ^5.x. Existing snapshots updated accordingly.Risk
Low. Only affects generated output; respects a customer's newer pin.