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: stop aliasing typescript in dependencies #3623

Merged
merged 2 commits into from
Jun 28, 2022
Merged

Conversation

RomainMuller
Copy link
Contributor

@RomainMuller RomainMuller commented Jun 28, 2022

Aliasing typescript to typescript-3.9 results in occasionally
surprising hoisting behavior, in particular using npm 18. In
particular, if two distinct versions of typescript are installed,
aliasing allows both to be hoisted at the top-level, which results in
ambiguity as to which of them gets to have the node_modules/.bin/tsc
symlink.

This PR stops aliasing typescript to typescript-3.9 and does the
necessary work to ensure builds continue to operate smoothly, menaing
it replaced TypeScript configuration files for jest with plain ESM
configuration files including typed JSDoc comments (for IDE supprot to
continue working as before), as jest otherwise uses ts-node to
transform the configuration files, and ts-node uses the "most local"
typescript library to perform this parsing (and unfortunately,
typescript@3.9 does not support the ES2020 target we are using).

This also required allowing jsii.tsc.types to be specified in the
package.json file of jsii projects, as otherwise the TypeScript
compiler attempts to load @types/* packages that are not compatible
with typescript@3.9 (for example, @synclair/typebox requires
typescript@>=4.5). This setting is anyway generally useful in
complex monorepo situations.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@RomainMuller RomainMuller requested a review from iliapolo June 28, 2022 10:50
@RomainMuller RomainMuller self-assigned this Jun 28, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 28, 2022
@RomainMuller RomainMuller force-pushed the rmuller/vanilla-tsc branch from 590a8f4 to 2775769 Compare June 28, 2022 10:51
Aliasing `typescript` to `typescript-3.9` results in occasionally
surprising hoisting behavior, in particular using `npm 18`. In
particular, if two distinct  versions of `typescript` are installed,
aliasing allows both to be hoisted at the top-level, which results in
ambiguity as to which of them gets to have the `node_modules/.bin/tsc`
symlink.

This PR stops aliasing `typescript` to `typescript-3.9` and does the
necessary work to ensure builds continue to operate smoothly, menaing
it replaced TypeScript configuration files for jest with plain ESM
configuration files including typed JSDoc comments (for IDE supprot to
continue working as before), as `jest` otherwise uses `ts-node` to
transform the configuration files, and  `ts-node` uses the "most local"
`typescript` library to perform this parsing (and unfortunately,
`typescript@3.9` does not support the `ES2020` target we are using).
@RomainMuller RomainMuller force-pushed the rmuller/vanilla-tsc branch from 42030dd to 2a0b6bd Compare June 28, 2022 17:03
@mergify
Copy link
Contributor

mergify bot commented Jun 28, 2022

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Jun 28, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 28, 2022

Merging (with squash)...

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented Jun 28, 2022

Merging (with squash)...

@mergify mergify bot merged commit 6d9dda5 into main Jun 28, 2022
@mergify mergify bot deleted the rmuller/vanilla-tsc branch June 28, 2022 18:18
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants