Skip to content

chore: Simplify tsconfig.json #1385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/typegpu-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@types/babel__standalone": "^7.1.9",
"@types/babel__template": "^7.4.4",
"@types/babel__traverse": "^7.20.7",
"@types/node": "^24.0.3",
"@webgpu/types": "catalog:",
"astro-vtbot": "^2.0.6",
"autoprefixer": "^10.4.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ${example.htmlFile.content}
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"typeRoots": ["./node_modules/@webgpu/types", "./node_modules/@types"],
"types": ["@webgpu/types"],
"moduleResolution": "node",
"allowImportingTsExtensions": true,
"isolatedModules": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ npm install react-native-wgpu
npm install typegpu
```

If you use TypeScript, then it's also recommended to install WebGPU types:
Since WebGPU is still yet to reach baseline in browsers, types for it need to be installed separately:

```sh
npm i --save-dev @webgpu/types
Expand All @@ -54,9 +54,7 @@ npm i --save-dev @webgpu/types
```js title="tsconfig.json"
{
"compilerOptions": {
"typeRoots": [
"./node_modules/@webgpu/types"
]
"types": ["@webgpu/types"]
},
}
```
Expand Down
6 changes: 1 addition & 5 deletions apps/typegpu-docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"typeRoots": [
"./node_modules/@webgpu/types",
"./node_modules/@types",
"src/types"
]
"types": ["@webgpu/types", "@types/dom-mediacapture-transform"]
},
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"fix": "biome lint --write . && deno fmt",
"test": "pnpm run test:circular-deps && pnpm run test:types && pnpm run test:style && pnpm run test:unit-and-attest",
"test:circular-deps": "pnpm dpdm -T --exit-code circular:1 packages/**/index.ts",
"test:types": "pnpm run -r --parallel test:types && pwd",
"test:types": "pnpm run -r --parallel test:types",
"test:style": "biome lint . && deno fmt --check",
"test:unit-and-attest": "vitest run",
"test:unit": "ATTEST_skipTypes=1 vitest run",
Expand All @@ -33,7 +33,6 @@
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@typegpu/tgpu-dev-cli": "workspace:*",
"@types/node": "^22.13.14",
"@vitest/coverage-v8": "3.1.2",
"@webgpu/types": "catalog:",
"dpdm": "^3.14.0",
Expand All @@ -44,7 +43,12 @@
},
"packageManager": "[email protected]+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af",
"pnpm": {
"onlyBuiltDependencies": ["@biomejs/biome", "esbuild", "sharp"],
"onlyBuiltDependencies": [
"@biomejs/biome",
"@tailwindcss/oxide",
"esbuild",
"sharp"
],
"overrides": {
"rollup": "4.34.8"
}
Expand Down
3 changes: 0 additions & 3 deletions packages/tgpu-jit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"typeRoots": ["./node_modules/@types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
3 changes: 0 additions & 3 deletions packages/tgpu-jit/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"typeRoots": ["./node_modules/@types"]
},
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules", "dist"]
}
3 changes: 0 additions & 3 deletions packages/tgpu-wgsl-parser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"typeRoots": ["./node_modules/@webgpu/types", "./node_modules/@types"]
},
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules", "dist"]
}
1 change: 0 additions & 1 deletion packages/typegpu-color/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"devDependencies": {
"@typegpu/tgpu-dev-cli": "workspace:*",
"@types/node": "^22.13.14",
"@webgpu/types": "catalog:",
"typegpu": "workspace:*",
"typescript": "catalog:",
Expand Down
1 change: 0 additions & 1 deletion packages/typegpu-noise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"devDependencies": {
"@typegpu/tgpu-dev-cli": "workspace:*",
"@types/node": "^22.13.14",
"@webgpu/types": "catalog:",
"unbuild": "catalog:",
"typegpu": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion packages/typegpu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"devDependencies": {
"@ark/attest": "^0.46.0",
"@typegpu/tgpu-dev-cli": "workspace:*",
"@types/node": "^22.13.14",
"@webgpu/types": "catalog:",
"arktype": "catalog:",
"jiti": "^2.4.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/typegpu/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout.ts';
import type { AnyData, Disarray } from './data/dataTypes.ts';
import type { WgslArray } from './data/wgslTypes.ts';
import { getName } from './shared/meta.ts';
import { DEV } from './shared/dev.ts';
import type { TgpuBindGroupLayout } from './tgpuBindGroupLayout.ts';

const prefix = 'Invariant failed';
Expand All @@ -21,7 +22,7 @@ export function invariant(
}

// In production we strip the message but still throw
if (process.env.NODE_ENV === 'production') {
if (!DEV) {
throw new Error(prefix);
}

Expand Down
9 changes: 9 additions & 0 deletions packages/typegpu/src/shared/dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* This can be used to branch functionality between "dev" and "prod" modes, so that our
* library can omit doing unnecessary work once it's out in the wild
*
* Even though the value of this constant uses Node.js specific APIs, pretty much every
* bundler replaces the expression below with either `development` or `production`
*/
// biome-ignore lint/suspicious/noExplicitAny: the types are not important here
export const DEV = (globalThis as any).process.env.NODE_ENV === 'development';
5 changes: 0 additions & 5 deletions packages/typegpu/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,4 @@ export default defineConfig({
minify: !inDevMode,
clean: true,
dts: true,
define: {
'process.env.NODE_ENV': JSON.stringify(
inDevMode ? 'development' : 'production',
),
},
});
Loading