Use `typeRoots` for custom type-defs
crrev.com/c/5081999 added in custom WebGPU types, however doing so via
`types:[]` overrides the TS default behaviour to include types from
`node_modules/@types`. This means in VSCode/LSP based editors, we now
get TS errors in tests from `assert` and `sinon`, which TS now cannot
detect (as it is not reading `node_modules/@types/...`).
To prevent this we can instead use `typeRoots`, and specify the folders
to use. This maintains the default behaviour and adds detection of the
WebGPU types.
Bug: 1506431
Change-Id: Ie5aed47bc630852305ecc101d05d7081dfa71647
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5083022
Reviewed-by: Simon Zünd <[email protected]>
Commit-Queue: Jack Franklin <[email protected]>
diff --git a/config/typescript/tsconfig.eslint.json b/config/typescript/tsconfig.eslint.json
index 5986900..f82fd22 100644
--- a/config/typescript/tsconfig.eslint.json
+++ b/config/typescript/tsconfig.eslint.json
@@ -8,7 +8,6 @@
"webworker",
"webworker.iterable"
],
- "types": ["@webgpu/types"],
"outDir": "ignored-for-vscode"
},
"include": [
diff --git a/tsconfig.json b/tsconfig.json
index 48b33f7..b5f82d8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,7 +8,7 @@
"webworker",
"webworker.iterable"
],
- "types": ["@webgpu/types"],
+ "typeRoots": ["./node_modules/@types", "./node_modules/@webgpu/types"],
"outDir": "ignored-for-vscode"
},
"include": [