diff --git a/scripts/typecheck.test.mjs b/scripts/typecheck.test.mjs new file mode 100644 index 00000000..4379f794 --- /dev/null +++ b/scripts/typecheck.test.mjs @@ -0,0 +1,23 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { spawnSync } from 'node:child_process'; +import path from 'node:path'; +import url from 'node:url'; + +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); +const repoRoot = path.join(__dirname, '..'); + +describe('npm run typecheck', () => { + it('runs tsc against tsconfig.json without TS5102 (removed baseUrl option)', () => { + const result = spawnSync('npx', ['tsc', '--noEmit'], { + cwd: repoRoot, + encoding: 'utf-8', + }); + + assert.equal( + result.status, + 0, + `tsc exited with ${result.status}:\n${result.stdout}${result.stderr}`, + ); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 7117c4fa..91e7e33c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,11 @@ "extends": "@docusaurus/tsconfig", "compilerOptions": { "ignoreDeprecations": "6.0", - "allowImportingTsExtensions": true + "allowImportingTsExtensions": true, + // @docusaurus/tsconfig still sets baseUrl, which TS 5.5+ (we're on ~7.0.2) + // rejects with TS5102 ("Option 'baseUrl' has been removed"). Overriding it + // to null here strips the inherited value from the merged config. + "baseUrl": null }, "exclude": [".docusaurus", "build"] }