You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typescript 4.7+ includes new the new "Node16"/"NodeNext" options for configuration options "module" and "moduleResolution". These adhere strictly to Node's package.json"exports" fields rules -- when that field is set the other root fields (like "types") are ignored.
The package.json for @sveltejs/adapter-static, and presumably other SvelteKit packages, does not list types in its "exports" field, causing Typescript to be unable to find types when using NodeNext module strategies.
It's an easy fix, and Typescript 4.7 is still in beta so the impact of this will slowly grow as adoption of latest Typescript versions increases.
Here's the diff generated via patch-package for @sveltejs/adapter-static:
Describe the bug
Typescript 4.7+ includes new the new
"Node16"
/"NodeNext"
options for configuration options"module"
and"moduleResolution"
. These adhere strictly to Node'spackage.json
"exports"
fields rules -- when that field is set the other root fields (like"types"
) are ignored.The
package.json
for@sveltejs/adapter-static
, and presumably other SvelteKit packages, does not list types in its"exports"
field, causing Typescript to be unable to find types when usingNodeNext
module strategies.It's an easy fix, and Typescript 4.7 is still in beta so the impact of this will slowly grow as adoption of latest Typescript versions increases.
Here's the diff generated via
patch-package
for@sveltejs/adapter-static
:Reproduction
With Typescript 4.7-beta and "module" set to "ESNext" or "NodeNext", we get an error finding the types:
https://www.typescriptlang.org/play?moduleResolution=99&target=99&jsx=0&allowSyntheticDefaultImports=true&ts=4.7.0-beta#code/JYWwDg9gTgLgBAQwCYLDAplAyjBNgDGcAZlBCHAOQACAzgG7oA2GAVrQPTKoZQC0tXPgKUA3EA
If we change the "module" to "CommonJs", the types are found successfully (ignore the newly-revealed error, it's unrelated to this issue):
https://www.typescriptlang.org/play?target=99&ts=4.7.0-beta&jsx=0&module=1&allowSyntheticDefaultImports=true#code/JYWwDg9gTgLgBAQwCYLDAplAyjBNgDGcAZlBCHAOQACAzgG7oA2GAVrQPTKoZQC0tXPgKUA3EA
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: