Search Terms
typesRoot, @types
Suggestion
typesRoot is folders you can specify where the compiler will looking up for types for modules without own types. But it looks like (according output with --traceResolution) it is used for /// <reference types directive, and isn't used to looking up modules when you import something. I think it'd be better to use it there as well.
Use Cases
For instance, you might have custom types folder with types for some packages (possible some packages has wrong declarations or even don't have them yet).
Examples
In the case above you can specify typesRoot to something like ["./custom-types","node_modules/@types"] and expect that the compiler will try to load types from custom-types folder if no typings exists in node_modules/@types.
Yeah, you can specify types option as well to load that type globally, but I'm not sure that loading every type globally is good idea.
As workaround right now you can "load" the types file with /// <reference types="type-name" /> and then import declared there modules (via declare module).
I'm not sure whether it's intended behaviour or not, but maybe we need to put some lights to the docs if so.
Checklist
My suggestion meets these guidelines:
Search Terms
typesRoot, @types
Suggestion
typesRootis folders you can specify where the compiler will looking up for types for modules without own types. But it looks like (according output with--traceResolution) it is used for/// <reference typesdirective, and isn't used to looking up modules when you import something. I think it'd be better to use it there as well.Use Cases
For instance, you might have custom types folder with types for some packages (possible some packages has wrong declarations or even don't have them yet).
Examples
In the case above you can specify
typesRootto something like["./custom-types","node_modules/@types"]and expect that the compiler will try to load types fromcustom-typesfolder if no typings exists innode_modules/@types.Yeah, you can specify
typesoption as well to load that type globally, but I'm not sure that loading every type globally is good idea.As workaround right now you can "load" the types file with
/// <reference types="type-name" />and then import declared there modules (viadeclare module).I'm not sure whether it's intended behaviour or not, but maybe we need to put some lights to the docs if so.
Checklist
My suggestion meets these guidelines: