Skip to content

Commit b295817

Browse files
mpstatonclaude
andcommitted
fix(shell): the shell's typecheck has never passed — missing css shim and a wrong element type
`pnpm --filter @augment-it/shell check` failed with two errors, and had done since the check script was written. Both are now fixed and the shell typechecks clean for the first time. The missing CSS shim had a root cause worth naming. shell/src/index.ts does a side-effect import of '@augment-it/theme/theme.css', which carries no type declarations — rsbuild resolves it at build time, but svelte-check cannot. Every app under apps/ ships a src/css.d.ts declaring `*.css` ambiently. The shell never did, and adding one would not have helped: shell/tsconfig.json was a byte-identical copy of the apps' old drifted variant, and that variant omits "src/**/*.d.ts" from `include`, so the shim would have been ignored. Both halves are fixed together — the shim exists, and the shell now extends tsconfig.base.json like the apps do. That makes the shell the eighteenth copy of the config converged earlier today, found only because this bug pointed at it. Its tsconfig drops from 20 lines to 4. The second error was a real type mismatch rather than a config artifact. `stageEl` was declared HTMLDivElement but is bound to `<main class="stage">`, which is an HTMLElement. Widened to HTMLElement, which is safe: the only member ever called on it is getBoundingClientRect(). Annotation-only — no runtime change, and the built output is unaffected. Verified: shell 93 files clean, and 1,587 files across all seventeen apps plus the shell now check with zero errors, up from 1,494 with the shell failing outright. 19 packages build. Files changed: - shell/src/css.d.ts (new) - shell/tsconfig.json - shell/src/App.svelte - tsconfig.base.json Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019a8tSPbFdvF1pKtADnWyDg
1 parent 45047cf commit b295817

4 files changed

Lines changed: 16 additions & 20 deletions

File tree

shell/src/App.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@
196196
197197
// ---- transient interaction state (never persisted) ----------------------
198198
let hoveredNeighborId = $state<string | null>(null);
199-
let stageEl = $state<HTMLDivElement | undefined>(undefined);
199+
// HTMLElement, not HTMLDivElement — this binds to <main class="stage">, and
200+
// only getBoundingClientRect() is ever called on it.
201+
let stageEl = $state<HTMLElement | undefined>(undefined);
200202
let resizing = $state<boolean>(false);
201203
let splitting = $state<boolean>(false);
202204

shell/src/css.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Side-effect CSS imports (@augment-it/theme/theme.css) carry no type
2+
// declarations — rsbuild resolves them at build time. Declare them ambiently
3+
// so svelte-check / tsc (stricter under TS 6) can resolve the side-effect
4+
// imports instead of erroring on the missing module.
5+
//
6+
// Every app under apps/ has carried this shim; the shell never did, because
7+
// its tsconfig omitted "src/**/*.d.ts" from `include` and the file would have
8+
// been ignored anyway. Both halves are fixed together.
9+
declare module '*.css';

shell/tsconfig.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
{
2-
"compilerOptions": {
3-
"target": "ES2022",
4-
"module": "ESNext",
5-
"moduleResolution": "bundler",
6-
"lib": ["DOM", "DOM.Iterable", "ES2022"],
7-
"strict": true,
8-
"noImplicitAny": true,
9-
"esModuleInterop": true,
10-
"skipLibCheck": true,
11-
"resolveJsonModule": true,
12-
"verbatimModuleSyntax": true,
13-
"noEmit": true,
14-
"allowImportingTsExtensions": true,
15-
"isolatedModules": true,
16-
"useDefineForClassFields": true,
17-
"types": ["svelte"]
18-
},
19-
"include": ["src/**/*.ts", "src/**/*.svelte", "src/**/*.svelte.ts"],
2+
"extends": "../tsconfig.base.json",
3+
"include": ["src/**/*.ts", "src/**/*.svelte", "src/**/*.svelte.ts", "src/**/*.d.ts"],
204
"exclude": ["node_modules", "dist"]
215
}

tsconfig.base.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"_comment": [
3-
"Shared TypeScript config for every federated member under apps/.",
3+
"Shared TypeScript config for every federated member under apps/, plus the",
4+
"federation host in shell/.",
45
"Before this file the 17 apps carried three byte-distinct tsconfig.json",
56
"variants in an 8/7/2 split \u2014 drift, not intent. The two differences were",
67
"an extra 'src/**/*.d.ts' include (kept, it picks up css.d.ts) and a",

0 commit comments

Comments
 (0)