Skip to content

Commit 8bb1c0a

Browse files
authored
Don't automatically include all types from dependencies (#3704)
* Add npm run lint * Don't automatically include all types from dependencies This produces an error if you try to use something from a global scope accidentally. It's only needed for "ambient" definitions; if the thing is included directly (like for all of the Node libraries like `fs`) then its types come along with it automatically. Also: - Replace `/// <reference />` usage because it does the same thing. - Remove unused `@types/node` dependency (TypeScript has that built in).
1 parent bc6b373 commit 8bb1c0a

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ module.exports = function (grunt) {
311311
]);
312312

313313
registerTaskAndAddToHelp('serve', 'Serve out/ (without building anything)', ['run:serve']);
314+
registerTaskAndAddToHelp('lint', 'Check lint and formatting', ['run:lint']);
314315
registerTaskAndAddToHelp('fix', 'Fix lint and formatting', ['run:fix']);
315316

316317
addExistingTaskToHelp('clean', 'Delete built and generated files');

package-lock.json

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"checks": "grunt checks",
1212
"unittest": "grunt unittest",
1313
"typecheck": "grunt typecheck",
14+
"lint": "grunt run:lint",
1415
"fix": "grunt fix",
1516
"gen_wpt_cts_html": "node tools/gen_wpt_cts_html",
1617
"gen_cache": "node tools/gen_cache",
@@ -43,7 +44,6 @@
4344
"@types/express": "^4.17.20",
4445
"@types/jquery": "^3.5.25",
4546
"@types/morgan": "^1.9.7",
46-
"@types/node": "^20.8.10",
4747
"@types/offscreencanvas": "^2019.7.2",
4848
"@types/pngjs": "^6.0.3",
4949
"@types/serve-index": "^1.9.3",

src/common/runtime/standalone.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Implements the standalone test runner (see also: /standalone/index.html).
2+
23
/* eslint no-console: "off" */
34

45
import { dataCache } from '../framework/data_cache.js';

src/common/util/navigator_gpu.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/// <reference types="@webgpu/types" />
2-
31
import { TestCaseRecorder } from '../framework/fixture.js';
42

53
import { ErrorWithExtra, assert, objectEquals } from './util.js';

tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"compilerOptions": {
44
"lib": ["dom", "es2020"],
55
"module": "esnext",
6+
// Use types only from these packages (not everything in package.json, which is the default).
7+
// Note that TypeScript's `/// <reference />` is the same as adding an entry here - it's global
8+
// to the whole project.
9+
"types": [
10+
"@types/dom-mediacapture-transform",
11+
"@webgpu/types",
12+
// Required for standalone.ts
13+
"@types/jquery",
14+
],
615
/* Output options */
716
"noEmit": true,
817
/* Strict type-checking options */

0 commit comments

Comments
 (0)