Skip to content

ADR-0002 phase 0: TypeScript gate — tsconfig, tsc --noEmit in the test gate, typed seam interfaces #262

Description

@BorisTyshkevich

Goal

Land phase 0 of ADR-0002 (docs/ADR-0002-static-typing.md — incremental strict TypeScript, dev-time only): the compiler gate and the first typed contracts (the injected seam interfaces), without converting any existing module and without changing the build or the artifact.

Everything after phase 0 is monotonic per-file conversion (seams → state.jscore/net/editor/ui/), piggybacked on normal feature work — no separate issue needed until a slice proves non-mechanical.

Scope

  • tsconfig.json at the repo root: strict: true, allowJs: true, checkJs: false, noEmit: true, erasableSyntaxOnly: true, moduleResolution: "bundler". Unconverted .js stays unchecked; every .ts file is strict from day one.
  • typescript devDependency (deliberate lockfile change; runtime deps stay four — hard rule 4 untouched, esbuild strips TS natively).
  • tsc --noEmit joins the gate: wired into npm test exactly like check:schemas (a pretest/check:types script), and into CI.
  • Seam interface files (type-only .ts, no runtime code): EditorPort, the env.SpecEditor/env.CodeViewer factory shapes, the createApp(env) environment, and the app controller surface as consumed by render modules. These are declarations of what already exists — no behavior change.
  • Coverage config: widen vitest coverage include to src/**/*.{js,ts}; exclude the type-only interface files (they have no executable statements) alongside src/generated/.
  • Docs: CLAUDE.md rule 1 gains "and tsc --noEmit must pass"; ADR-0002 status updated on landing.

Acceptance

  • npm test fails on a deliberate type error in a .ts file and passes clean without it.
  • npm run build output is unchanged in kind: four bundled runtime deps, zero third-party requests; the type-only seam files contribute no bytes to dist/sql.html.
  • Full coverage gate still green (per-file thresholds unchanged).
  • Seam interfaces compile against real usage: at least one existing call site per interface is spot-checked via a scratch .ts import during review (the interfaces must describe reality, not aspiration).
  • CLAUDE.md rule 1 + ADR-0002 status updated in the same PR.

Non-goals (later phases / follow-ups)

  • Converting any existing .js module (phase 1+, leaf-up per ADR-0002 §4).
  • Schema-generated .d.ts for Library/saved-query/Spec shapes via compile-json-schemas.mjs (ADR-0002 §3 — its own follow-up once the gate exists).
  • A JSDoc sweep of unconverted files.

References

  • ADR-0002 (docs/ADR-0002-static-typing.md) — the decision this implements.
  • ADR-0001 — the slice-by-slice migration playbook this reuses; its 2026-07 addendum re-affirms no-framework and notes TS reduces the framework pull.
  • Roadmap Roadmap to 1.0.0 #68.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions