-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Support TypeScript "moduleResolution": "node16"
#637
Comments
moduleResolution: node16
"moduleResolution": "node16"
Found the issue. Seems like the "type" field in swup's {
"compilerOptions": {
"moduleResolution": "node16",
"paths": {
"swup": ["./node_modules/swup/dist/types/index.d.ts"]
}
}
} |
So is there an obvious solution? Adding file extensions? Maybe it's looking for a |
No obvious solution, yet... swup is already using the {
"types": "dist/types/index.d.ts",
} @gmrchk do you have an idea what's going on? |
I think I found the issue. Swup just needs to use fully qualified imports throughout it's code base as well. Then microbundle will also export the correct types, as described here. I'll create a PR. |
Scratch that – I was able to switch from jest to vitest to allow for esm types, but actually forgot that I still had the "paths" option set in my test project's
THIS is what makes it work. I don't get it... |
Description of the issue
If a consumer project's
compilerOptions.moduleResolution
is set tonode16
, swup's types can't be resolved anymore. Here's a screenshot:And one of the
index.d.ts
:How to reproduce the issue
Add this to the
tsconfig.json
of a project that imports "swup":Now TypeScript can't resolve swup's types anymore, since they are all using unqualified imports.
Proposed Solution
All types should use qualified exports. So for
index.d.ts
, instead ofit should be:
and so on. I tested this and it
works with both. EDIT: Weird... it just worked for a bit with the qualified imports in the d.ts files, but now it doesn't anymore. Not sure what changed... 🤔moduleResolution: node
as well asmoduleResolution: node16
Before creating this issue...
The text was updated successfully, but these errors were encountered: