Node 12 ESM reports different errors between editor and CLI #47795
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
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: