Overriding default typeRoots does not seem to be working #4929
Replies: 7 comments 2 replies
-
I too have had issues on how to implement typings in my Nx monorepo, particularly types that are going to be shared between a number of libraries. CURRENT STATE: FUTURE STATE |
Beta Was this translation helpful? Give feedback.
-
I do not fully understand your solution. I have defined two modules in two seperate .d.ts files. How can I share them accross libs? I have tried multiple configs, but nothing worked. Would really appreciate help! |
Beta Was this translation helpful? Give feedback.
-
something new about this? I have the same issue. I tried all the possible combinations:
"typeRoots": ["./node_modules", "./typings", "libs/web-components/types"],
"typeRoots": ["../../node_modules", "./types", "../../typings"]
"typeRoots": [
"../../node_modules",
"../../libs/web-components/types",
"../../typings"
] |
Beta Was this translation helpful? Give feedback.
-
Any news on this topic ? I seem to have the same issue |
Beta Was this translation helpful? Give feedback.
-
How about using a generator adding |
Beta Was this translation helpful? Give feedback.
-
I also solved this by adding the path to include as @peter-wd-1 did. However this is a brittle solution as you now have to override the nx generators(yay) plus if you ever move your folder structure it all breaks. Just seems tsc would have a solution for this. |
Beta Was this translation helpful? Give feedback.
-
Hello from 2025 👋🏻. Any movements on this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone have any suggestions as a way to create a
types
library that will be used to declare modules and then be referenced in other libraries? I have tried the following:Overriding the
DefaultTheme
in thestyled-components/native
moduleThen configuring
typeRoots
on thelibs/components
library like so:Finally importing it on that library and getting it’s overridden values
Where
DefaultTheme
would be anobject
with thecolors
key as astring
, but it's not. It keeps defaulting to thestyled-components/native
interface.Another thing, as per TypeScript's typeRoots documentation, if
typeRoots
is specified, only packages undertypeRoots
will be included. For example:This config file will include all packages under
./typings
and./vendor/types
, and no packages from./node_modules/@types
. All paths are relative to thetsconfig.json
.But this does not appear to happen either, if I have
typeRoots
specified in a library, the./node_modules/@types
are still being defined.Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions