Skip to content

Conversation

@vakrilov
Copy link
Contributor

@vakrilov vakrilov commented Aug 13, 2019

The @nativescript/schematics package uses TypeScript utility functions from @schematics/angular. The utility functions return ASTs generated from the source code. After that these ASTs are used by other functions in @nativescript/schematics.
@nativescript/schematics depends on the version of TypeScript used in the project, whereas @schematics/angular embeds its own version of typescript. If the versions of the two TypeScript packages don't match, we end up comparing ASTs generated from different TS versions which usually results in an error. Currently, we rely on the assumption that the project will have matching versions of @schematics/angular and TypeScript.

With this PR, the code using utilities from @schematics/angular now imports typescript from @schematics/angular guaranteeing the same instance of the TypeScript library will be used.

@cla-bot cla-bot bot added the cla: yes label Aug 13, 2019
Copy link
Contributor

@sis0k0 sis0k0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Should we also remove the devDependency to TypeScript?

@vakrilov
Copy link
Contributor Author

vakrilov commented Aug 19, 2019

Tried removing the typescript devDependency, but there are a couple of packages (@phenomnomnominal/tsquery, tslint) that require typescript. Removing the dep will break the tests (also npm run build uses tsc).

@vakrilov vakrilov marked this pull request as ready for review August 19, 2019 12:23
@sis0k0 sis0k0 changed the title chore: use typescript from @schmatics/angular fix: use typescript from @schematics/angular Aug 19, 2019
@sis0k0 sis0k0 merged commit 4c6c2ec into master Aug 19, 2019
@sis0k0 sis0k0 deleted the ts-from-ng-schematics branch August 19, 2019 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants