Skip to content

Commit 7889908

Browse files
RokaSwKclaude
andcommitted
Type-check the server and scripts with tsrs, and stable tsc as a guard
server/tsconfig.json (strict, noEmit, erasableSyntaxOnly, verbatimModuleSyntax, allowImportingTsExtensions) covers server/ and scripts/. npm run check runs it with tsrs, then with typescript 7.0.2, because TypeScript 7.1 (which tsrs follows) misses some errors on destructured parameters with a = {} default (microsoft/TypeScript#64431). Type tools are server devDependencies, which releases omit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 88e077d commit 7889908

4 files changed

Lines changed: 600 additions & 4 deletions

File tree

‎scripts/check.mts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/usr/bin/env node
2-
// The full gate: web tests, build, server tests, fixture and asset checks.
2+
// The full gate: web tests and build (which type-checks web), the server and scripts type-check,
3+
// server tests, fixture and asset checks. Any non-zero exit fails it (tsrs exits 2 on type errors).
34
import { spawnSync } from 'node:child_process';
45
import { readdirSync } from 'node:fs';
56
import { fileURLToPath } from 'node:url';
67
import path from 'node:path';
78

89
const root = fileURLToPath(new URL('../', import.meta.url));
9-
const run = (command, args, cwd = root) => { const { status } = spawnSync(command, args, { cwd, stdio: 'inherit' }); if (status !== 0) process.exit(status ?? 1); };
10+
const run = (command: string, args: string[], cwd = root) => { const { status } = spawnSync(command, args, { cwd, stdio: 'inherit' }); if (status !== 0) process.exit(status ?? 1); };
1011
run('npm', ['test'], path.join(root, 'web'));
1112
run('npm', ['run', 'build'], path.join(root, 'web'));
13+
run('npm', ['run', 'typecheck'], path.join(root, 'server'));
14+
// Guard: stable tsc (7.0) too. tsrs follows TypeScript 7.1, which infers destructured parameters with a
15+
// `= {}` default differently (https://github.com/microsoft/TypeScript/issues/64431) and so misses some
16+
// errors 7.0 reports. Remove this line once that is fixed upstream and tsrs picks it up.
17+
run('npm', ['run', 'typecheck:stable'], path.join(root, 'server'));
1218
run('node', ['--test', ...readdirSync(path.join(root, 'server')).filter((name) => name.endsWith('.test.mts'))], path.join(root, 'server'));
1319
run('node', ['--test', 'scripts/fixture.test.mts']);
1420
run('node', ['--test', 'scripts/verify-assets.test.mts']);

0 commit comments

Comments
 (0)