-
Notifications
You must be signed in to change notification settings - Fork 75
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
Use node16 in tsconfig.json #2052
Conversation
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"module": "node16", | ||
"moduleResolution": "node16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to this file shouldn't actually be needed if you prefer to stay to nodenext
packages/typespec-ts/test/integration/generated/azure/core/src/clientDefinitions.ts
Outdated
Show resolved
Hide resolved
faa7df9
to
dd8d06f
Compare
@@ -5,8 +5,8 @@ | |||
"composite": true, | |||
"lib": ["ES2019"], | |||
"target": "es2019", | |||
"module": "NodeNext", | |||
"moduleResolution": "NodeNext", | |||
"module": "node16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change! The issue we found happens in dev version e.g "@azure-tools/typespec-azure-core": "0.35.0-dev.11"
and see pr #2053. And in our main we use the stable version not dev one.
Can you also make a pr to apply your change in my test branch? So we could verify it works or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change should happen regardless of the version of typespec that you are using. You might get into the same issue with other packages in the future. So I would just merge that if it is not causing any issues anyway. If there is more problem to the dev version then we can investigate further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Use typespec recommended tsconfig setting https://microsoft.github.io/typespec/extending-typespec/basics#4-create-libts, this is needed to correctly support node exports.
Switch module and moduleResolution to use node16 to tell typescript that it should resolve modules following node 16+ exports
See this stackoverflow for details https://stackoverflow.com/questions/58990498/package-json-exports-field-not-working-with-typescript
Change in last release of typescript removed the
typesVersions
which was the legacy way of specifying the types for additional path. So this setting is required to work correctly with node exports