I have a unique yarn monorepo structure that is oddly shaped. Here's how it's set up:
monorepo root
├── frontend
│ ├── dashboard <-- not managed by yarn workspaces
│ | ├── src
│ | ├── node_modules
│ | ├── tsconfig.json
├── node_modules <-- hoisted by yarn
├── packages
│ ├── another typescript project <-- included in yarn workspaces
│ | ├── tsconfig.json
│ | ├── node_modules
All the tsconfig.json
files are configured with this setting:
compilerOptions: {
"typeRoots": [
"./node_modules/@types/"
]
}
In addition, the exclude
property is also specified as follows:
"exclude": [
"node_modules/**/*",
"../../node_modules/**/*"
]
After running tsc
within frontend/dashboard, I encounter the following error:
node_modules/@types/react/index.d.ts:3088:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
3088 type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
~~~~~~~~~~~~~~~~~~~~~~~~
../../node_modules/@types/react/index.d.ts:3100:14
3100 type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
~~~~~~~~~~~~~~~~~~~~~~~~
'LibraryManagedAttributes' was also declared here.
I'm puzzled as to why Typescript is venturing outside of the designated typeRoots
directories?