Suggestion
π Search Terms
List of keywords you searched for before creating this issue: I've tried resolveModuleName, typeRoot, api and their combinations.
β
Viability Checklist
β Suggestion
At the Compiler API Wiki, You can see that resolveModuleNames suggested implementation treats node modules packages typings and custom typings differently (here).
This means anyone that uses the ts.resolveModuleName API has to implement the fallback and search on moduleSearchLocations (which I assume, we'll get those by reading the tsconfig and scanning for the typeRoot.
I am not sure whether this is a bug or not, but I would assume ts.resolveModuleName would respect the typeRoots given in the passed compiler options. What do you think? Is there a reason it doesn't behave this way?
NOTE: I've not just relied on the example, I've tested it myself.
π» Use Cases
Any tool that uses the compiler API will need this, for example, I'm writing an ESLint plugin that makes sure every dependency either comes with type declarations or it has the corresponding @types package installed next to it. (It's here)
Thanks!
Suggestion
π Search Terms
List of keywords you searched for before creating this issue: I've tried
resolveModuleName,typeRoot,apiand their combinations.β Viability Checklist
β Suggestion
At the Compiler API Wiki, You can see that
resolveModuleNamessuggested implementation treats node modules packages typings and custom typings differently (here).This means anyone that uses the
ts.resolveModuleNameAPI has to implement the fallback and search onmoduleSearchLocations(which I assume, we'll get those by reading thetsconfigand scanning for thetypeRoot.I am not sure whether this is a bug or not, but I would assume
ts.resolveModuleNamewould respect thetypeRootsgiven in the passed compiler options. What do you think? Is there a reason it doesn't behave this way?NOTE: I've not just relied on the example, I've tested it myself.
π» Use Cases
Any tool that uses the compiler API will need this, for example, I'm writing an ESLint plugin that makes sure every dependency either comes with type declarations or it has the corresponding
@typespackage installed next to it. (It's here)Thanks!