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
I expect to be able to import @typescript-eslint/typescript-estree without a module resolution error
Actual Result
$ ./node_modules/.bin/tsc
test.ts:1:37 - error TS2307: Cannot find module '@typescript-eslint/typescript-estree' or its corresponding type declarations.
1 import type { AST_NODE_TYPES } from "@typescript-eslint/typescript-estree";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in test.ts:1
ERROR: //tools:node did not exit successfully.
If you suspect that there's a problem with the tool, try contacting the team that owns it: web-build
Additional Info
If I upgrade to the latest typescript (5.3.3 - I suspect any >= 5 can work) and set moduleResolution: bundler, then I am able to get past the module resolution error (and instead encounter #8047).
Based on --traceResolution, I originally thought part of the problem is the typeVersions which is not giving versions for typescript >=4.7
======== Resolving module '@typescript-eslint/typescript-estree' from '/home/dgoldstein/src/test_tseslint/test.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module '@typescript-eslint/typescript-estree' from 'node_modules' folder, target file type 'TypeScript'.
Found 'package.json' at '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/package.json'.
'package.json' has a 'typesVersions' field with version-specific path mappings.
'package.json' does not have a 'typesVersions' entry that matches version '4.9'.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.ts' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.tsx' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' does not have a 'main' field.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.ts' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.tsx' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.d.ts' does not exist.
Directory '/home/dgoldstein/src/test_tseslint/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/dgoldstein/src/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/dgoldstein/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Loading module '@typescript-eslint/typescript-estree' from 'node_modules' folder, target file type 'JavaScript'.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/package.json' exists according to earlier cached lookups.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.js' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.jsx' does not exist.
'package.json' does not have a 'main' field.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.js' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.jsx' does not exist.
Directory '/home/dgoldstein/src/node_modules' does not exist, skipping all lookups in it.
Directory '/home/dgoldstein/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@typescript-eslint/typescript-estree' was not resolved. ========
but downgrading typescript just gives a different failed resolution trace. I think the real problem is that @typescript-eslint/ packages have started expressing their package.json in a way that only the newer forms of moduleResolution (node16, nodenext, and bundler) understand.
Versions
package
version
@typescript-eslint/typescript-estree
6.18.1
TypeScript
4.9.5
node
16.18.0
The text was updated successfully, but these errors were encountered:
As mentioned in the pinned issue: #7284, you can try to set "moduleResolution" to the "NodeNext" or "Node16" ("Bundler" was introduced in TS v5.0, but "NodeNext"/"Node16" should work for this too)
ok this is my mistake then. I unfortunately didn't come across that pinned issue in my search. Fwiw I mistakenly thought that node16/nodenext were TS >=5.0 options (whoops), and annoyingly the TSconfig reference docs don't say when each value was introduced.
That said... I also have never seen a library that drops support for node <16 also start requiring moduleResolution: node16 - for every other package I've ever seen, dropping support for node <16 means that the new version may fail at runtime, not at typecheck time. So @typescript-eslint/ is definitely an outlier here - I've been using moduleResolution: node with 100s of other packages with no problems at all.
Before You File a Bug Report Please Confirm You Have Done The Following...
Relevant Package
typescript-estree
Playground Link
No response
Repro Code
install this with
npm install
(yarn works too) then run tscExpected Result
I expect to be able to import @typescript-eslint/typescript-estree without a module resolution error
Actual Result
Additional Info
If I upgrade to the latest typescript (5.3.3 - I suspect any >= 5 can work) and set moduleResolution: bundler, then I am able to get past the module resolution error (and instead encounter #8047).
Based on --traceResolution, I originally thought part of the problem is the typeVersions which is not giving versions for typescript >=4.7
but downgrading typescript just gives a different failed resolution trace. I think the real problem is that @typescript-eslint/ packages have started expressing their package.json in a way that only the newer forms of moduleResolution (node16, nodenext, and bundler) understand.
Versions
@typescript-eslint/typescript-estree
6.18.1
TypeScript
4.9.5
node
16.18.0
The text was updated successfully, but these errors were encountered: