-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Module resolution: NodeNext breaks typechecking #60561
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
Comments
I think we can also assume that as people will switch from tsx-like tools to the native nodejs flag to have typescript, the more we'll see this. |
The repo doesn't appear to be set up correctly?
|
@RyanCavanaugh sorry, I fixed it (a typo leftover from my cleanup to provide you the smallest repro as possible). |
Hey @RyanCavanaugh, have you guys had a chance to look into the repro? ![]() |
I don't see any file that looks like that in |
Hi there, I did have the same issue with an import from I also created a little stackblitz to show the issue: https://stackblitz.com/edit/storyblok-js-client-typescript-issue. Investigating a bit, it seems like, that even if the imports are resolved correctly, typescript acts as if the package is a common js package. |
@leifmarcus the problem is in |
@RyanCavanaugh thank you very much! I didn’t know about the tool, you sent. appreciate. |
@RyanCavanaugh did you actually checkout the branch as I described in the issue report? git clone [email protected]:damianobarbati/ts-repro.git
cd ts-repro
git checkout typescript-constructable-issue
pnpm i
pnpm tsc I just tested tsc again, and the problem is right there; in the real projects I'm working on, we have this on several libraries and we're just suppressing with @ts-ignore everywhere as we don't know how to properly solve this. $ pnpm tsc
> [email protected] tsc /Users/damians/Desktop/ts-repro
> tsc
services/api/src/index.ts:2:19 - error TS2351: This expression is not constructable.
Type 'typeof import("/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/index")' has no construct signatures.
2 const redis = new Redis();
~~~~~
Found 1 error in services/api/src/index.ts:2
ELIFECYCLE Command failed with exit code 1. |
Yeah, that does look wrong. It looks like the re-exported |
Demo Repo
https://github.com/damianobarbati/ts-repro
Which of the following problems are you reporting?
The module specifier resolves to the right file, but something about the types are wrong.
I'm using NodeNext to leverage the new node flag --transform-types.
Demonstrate the defect described above with a code sample.
To reproduce:
Here the line where this can be seen:
https://github.com/damianobarbati/ts-repro/blob/typescript-constructable-issue/services/api/src/index.ts#L2
Run
tsc --showConfig
and paste its output hereRun
tsc --traceResolution
and paste its output herePaste the
package.json
of the importing module, if it existsPaste the
package.json
of the target module, if it existsAny other comments can go here
I'm using NodeNext to leverage the new node flag
--transform-types
.The text was updated successfully, but these errors were encountered: