Skip to content

fix(scripts): add allowImportingTsExtensions to tsconfig.scripts.json - #5974

Merged
yinlianghui-tw merged 1 commit into
mainfrom
claude/issue-4926-scripts-tsconfig-option-parity
Aug 24, 2026
Merged

fix(scripts): add allowImportingTsExtensions to tsconfig.scripts.json#5974
yinlianghui-tw merged 1 commit into
mainfrom
claude/issue-4926-scripts-tsconfig-option-parity

Conversation

@yinlianghui-tw

Copy link
Copy Markdown
Collaborator

Fixes#4926

What

tsconfig.scripts.json's header claims it matches apps/console/tsconfig.node.json's option set so the two files shared between both programs (scripts/vite-crypto-stub.ts, scripts/vite-maplibre-worker.ts) "cannot be green in one project and red in the other." It omitted allowImportingTsExtensions, which the console project sets (line 30) because apps/console/vite.config.ts imports the shared files with explicit .ts extensions (objectui#3384).

  • Added "allowImportingTsExtensions": true to tsconfig.scripts.json (legal under its existing noEmit: true), and expanded the header comment to name it as part of the matched set.
  • Added an option-parity assertion test in scripts/__tests__/scripts-type-check.test.ts that reads both parsed tsconfigs and asserts strict, module, moduleResolution, allowImportingTsExtensions, and the absence of noImplicitReturns agree — narrowly scoped to only the options the header itself claims are matched (not composite/outDir/rootDir/allowJs/target/emit, which differ by design). This is the pin location the issue itself named.

Mechanism finding (dispatch's open question)

The dispatch asked whether the divergence produces a live red today or is latent. Confirmed latentpnpm type-check:scripts is green both before and after this change; neither shared file itself contains a .ts-extension import.

I did find where allowImportingTsExtensions is actually exercised (something the PM's ./-relative grep missed, since these are ../../-relative):

$ grep -n "scripts/vite-" apps/console/vite.config.ts
17:import { viteCryptoStub } from '../../scripts/vite-crypto-stub.ts';
18:import { viteMaplibreWorker } from '../../scripts/vite-maplibre-worker.ts';
19:import { resolveSpecDistInjection } from '../../scripts/vite-objectstack-spec-dist.ts';

That's on the console side, inside apps/console/tsconfig.node.json's own program — not inside tsconfig.scripts.json's (include: ["scripts/**/*.ts"] never reaches apps/console/vite.config.ts). To reproduce the issue's own repro exactly, I widened a scratch copy of tsconfig.scripts.json to also include apps/console/vite.config.ts (not committed) and reran tsc:

apps/console/vite.config.ts(17,32): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
apps/console/vite.config.ts(18,36): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
apps/console/vite.config.ts(19,42): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

Same three TS5097s the issue reported. So: invariant restoration, not a live-bug fix — the gap surfaces only if a shared file gains a .ts-extension import, or the scripts program's include widens to reach a file that has one (exactly the shape the header defends against). Reverse-verified the new pin test on the committed fix by checking out the pre-fix tsconfig.scripts.json from origin/main and rerunning — the new assertion failed with the expected message, then I restored the fix from HEAD.

Scope

Per dispatch: this PR touches only the one option-set divergence. tsconfig.scripts.json is not restructured to extends anything (its header's tsconfig.base.json-exclude reasoning stands, unchallenged). No other option differences between the two projects were found or touched.

Tests

  • pnpm type-check:scripts — clean (before and after).
  • pnpm --filter '@object-ui/console^...' build then pnpm --filter '@object-ui/console' type-check (tsc --noEmit && tsc -b tsconfig.node.json --force) — clean.
  • npx vitest run scripts/__tests__ — 62 test files, 1665 tests, all passing (includes the new assertion, 9/9 in scripts-type-check.test.ts, up from 8/8).
  • node scripts/check-type-check-coverage.mjs — ✅ (45/46 via type-check, unrelated pre-existing 1 not-compiled; 41/41 test coverage).
  • node scripts/check-changeset-presence.mjs — ✅ no changeset owed (tooling config + test file, not a published package's src/).
  • node scripts/check-control-bytes.mjs — ✅ clean.
  • npx eslint scripts/__tests__/scripts-type-check.test.ts --no-inline-config — 0 errors.

Verified at 2ce7ee4de (branch head).

Generated by Claude Code


Generated by Claude Code

tsconfig.scripts.json's header claims it matches
apps/console/tsconfig.node.json's option set so a file shared between the two
programs (scripts/vite-crypto-stub.ts, scripts/vite-maplibre-worker.ts)
cannot be green in one and red in the other. It omitted
allowImportingTsExtensions, which the console project sets because
vite.config.ts imports the shared files with explicit .ts extensions
(objectui#3384). Add the option (legal under noEmit: true) and pin the
parity against apps/console/tsconfig.node.json directly in
scripts-type-check.test.ts, per the issue's own suggestion for where the
choice should be pinned.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019b5UBNMtTzKbVtZZGvFuxe
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants

@yinlianghui-tw@claude