Reputation: 11285
I am running into an issue with TypeScript where it is checking my node_modules
directory. I am using yarn workspaces with a project structure setup as:
└─ .
├─ package.json
├─ packages
│ ├─ admin
│ │ ├─ src
│ │ └─ tsconfig.json
│ ├─ api
│ │ ├─ package.json
│ │ ├─ src
│ │ ├─ tests
│ │ ├─ tsconfig.json
│ │ ├─ tsconfig.tsbuildinfo
│ │ ├─ tslint.json
│ ├─ client
│ │ ├─ package.json
│ │ ├─ tsconfig.json
│ │ ├─ types.d.ts
│ │ └─ updateDependencies.js
│ └─ core
│ ├─ package.json
│ ├─ src
│ ├─ tests
│ └─ tsconfig.json
├─ tsconfig.json
└─ yarn.lock
{
"exclude": ["./node_modules", "./node_modules/**/*", "node_modules", "dist"],
"compilerOptions": {
"baseUrl": ".",
"sourceMap": true,
"paths": {
"@projectName/core": ["./packages/core/src"],
"@projectName/api": ["./packages/api/src"],
"@projectName/admin": ["./packages/admin/src"],
"@projectName/client": ["./packages/client"]
}
}
}
as an aside, paths
doesn't work for me. I still have to traverse the tree, such as: @projectName/core/src/models/whatever
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"lib": ["ES2019"],
"module": "commonjs",
"target": "ES2019",
"strict": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"rootDir": "./src"
},
"include": ["./src/**/*"]
}
yarn run v1.22.4
$ tsc
../../node_modules/@types/draft-js/index.d.ts:203:49 - error TS2304: Cannot find name 'Blob'.
203 handlePastedFiles?(files: Array<Blob>): DraftHandleValue;
~~~~
../../node_modules/@types/draft-js/index.d.ts:206:77 - error TS2304: Cannot find name 'Blob'.
206 handleDroppedFiles?(selection: SelectionState, files: Array<Blob>): DraftHandleValue;
~~~~
../../node_modules/@types/googlemaps/index.d.ts:439:34 - error TS2304: Cannot find name 'Node'.
439 controls: Array<MVCArray<Node>>;
~~~~
../../node_modules/@types/googlemaps/index.d.ts:1609:38 - error TS2304: Cannot find name 'Node'.
1609 setContent(content: string | Node): void;
~~~~
../../node_modules/@types/googlemaps/index.d.ts:1622:28 - error TS2304: Cannot find name 'Node'.
1622 content?: string | Node;
~~~~
../../node_modules/@types/googlemaps/index.d.ts:2602:32 - error TS2304: Cannot find name 'Node'.
2602 constructor(container: Node, opts?: SaveWidgetOptions);
~~~~
../../node_modules/@types/googlemaps/index.d.ts:2905:34 - error TS2304: Cannot find name 'Node'.
2905 controls: Array<MVCArray<Node>>;
~~~~
../../node_modules/@types/isomorphic-fetch/index.d.ts:8:30 - error TS2552: Cannot find name 'fetch'. Did you mean '_fetch'?
8 declare const _fetch: typeof fetch;
~~~~~
../../node_modules/@types/isomorphic-fetch/index.d.ts:8:15
8 declare const _fetch: typeof fetch;
~~~~~~
'_fetch' is declared here.
../../node_modules/@types/testing-library__dom/events.d.ts:86:59 - error TS2304: Cannot find name 'Window'.
86 export type FireFunction = (element: Document | Element | Window | Node, event: Event) => boolean;
~~~~~~
../../node_modules/@types/testing-library__dom/events.d.ts:86:68 - error TS2304: Cannot find name 'Node'.
86 export type FireFunction = (element: Document | Element | Window | Node, event: Event) => boolean;
~~~~
../../node_modules/@types/testing-library__dom/events.d.ts:88:54 - error TS2304: Cannot find name 'Window'.
88 [K in EventType]: (element: Document | Element | Window | Node, options?: {}) => boolean;
~~~~~~
../../node_modules/@types/testing-library__dom/events.d.ts:88:63 - error TS2304: Cannot find name 'Node'.
88 [K in EventType]: (element: Document | Element | Window | Node, options?: {}) => boolean;
~~~~
../../node_modules/@types/testing-library__dom/events.d.ts:91:54 - error TS2304: Cannot find name 'Window'.
91 [K in EventType]: (element: Document | Element | Window | Node, options?: {}) => Event;
~~~~~~
../../node_modules/@types/testing-library__dom/events.d.ts:91:63 - error TS2304: Cannot find name 'Node'.
91 [K in EventType]: (element: Document | Element | Window | Node, options?: {}) => Event;
~~~~
../../node_modules/@types/testing-library__dom/pretty-dom.d.ts:3:43 - error TS2304: Cannot find name 'HTMLDocument'.
3 export function prettyDOM(dom?: Element | HTMLDocument, maxLength?: number, options?: OptionsReceived): string | false;
~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/pretty-dom.d.ts:4:40 - error TS2304: Cannot find name 'HTMLDocument'.
4 export function logDOM(dom?: Element | HTMLDocument, maxLength?: number, options?: OptionsReceived): void;
~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/screen.d.ts:11:28 - error TS2304: Cannot find name 'HTMLDocument'.
11 element: Element | HTMLDocument | Array<Element | HTMLDocument>,
~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/screen.d.ts:11:59 - error TS2304: Cannot find name 'HTMLDocument'.
11 element: Element | HTMLDocument | Array<Element | HTMLDocument>,
~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/wait-for-dom-change.d.ts:4:31 - error TS2304: Cannot find name 'MutationObserverInit'.
4 mutationObserverOptions?: MutationObserverInit;
~~~~~~~~~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/wait-for-element-to-be-removed.d.ts:7:35 - error TS2304: Cannot find name 'MutationObserverInit'.
7 mutationObserverOptions?: MutationObserverInit;
~~~~~~~~~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/wait-for-element.d.ts:4:31 - error TS2304: Cannot find name 'MutationObserverInit'.
4 mutationObserverOptions?: MutationObserverInit;
~~~~~~~~~~~~~~~~~~~~
../../node_modules/@types/testing-library__dom/wait-for.d.ts:7:35 - error TS2304: Cannot find name 'MutationObserverInit'.
7 mutationObserverOptions?: MutationObserverInit;
~~~~~~~~~~~~~~~~~~~~
Found 22 errors.
Upvotes: 1
Views: 1650
Reputation: 11283
Could you try to append ./tsconfig.json
with
"exclude" : {
"packages/*/node_modules"
}
Or
"exclude" : {
"**/node_modules"
}
?
--Edit
Looks like thing is not related to exclude at all.
{
"compilerOptions": {
"skipLibCheck": true,
}
}
Upvotes: 4