-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Node 12 ESM reports different errors between editor and CLI #47795
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
A slightly different bug, but another example of the VS Code editor displaying different TypeScript type errors to the |
Wooooooo, so this is a weird one. First off, playwright. Playwright doesn't have it's esm entrypoint explicitly typed (only its cjs entrypoint). So what're you getting, then? Since you're working with a |
I don't have anything to add to that except 😫 |
Wait, I guess I do. If you use a However, if you switch to a So it's very weird.
Based on what you said, I would expect errors in both the CLI and editor scenarios for |
Uh oh!
There was an error while loading. Please reload this page.
Originally posted by @jaydenseric in #47792 (comment)
I've been using TypeScript v4.6-dev.x and the
node12
mode extensively for some time now. One of the things that makes it really confusing to work with the newnode12
mode is that often VS Code lies and is able to display types for imports ok within the editor (yes, with the local TypeScript installation selected in VS Code), when reallytsc
via the CLI can't resolve the types. You will see "has no exported member" type errors for the same imports, when the imported package doesn't support TypeScript v4.6node12
mode properly with correct packageexports
,.d.mts
files, etc.It makes it harder to evaluate as you are working what packages are ESM ready and to experiment with possible fixes for a PR by hacking them in
node_modules
, since you have to ignore what the editor is saying and keep running thetsc
CLI for feedback.An example of a package this happens with is
playwright@1.18.1
...With this
.vscode/settings.json
:And this
jsconfig.json
:And this package
devDependency
:And this package
scripts
:If you run:
In
a.mjs
:In
b.mts
:In the VS Code editor the imported
Page
type resolves for intellisense:But via
tsc
:The
playwright
package doesn't appear to be in the list of "popular" packages for this issue, but given it's pretty popular and also a Microsoft project that aims to support TypeScript it would really make sense for it to be fully compatible with TypeScript v4.6.Originally posted by @jaydenseric in #47792 (comment)
The text was updated successfully, but these errors were encountered: