Skip to content

Carry-overs from the April 2026 TypeScript audit #777

Description

@InfinityBowman

Five items from packages/docs/audits/typescript-audit-2026-04.md are still open. That document remains the correct specification for each; this issue exists to keep them visible.

Status since April

Signal Apr 2026 Sep 2026
as any ~144 109
as Record<string, unknown> 115 96
as Error ~100 101
satisfies 4 8
Type tests (expectTypeOf) 0 0
createServerFn 0 19 files
@ts-ignore / @ts-expect-error 3 0

Landed: typed-RPC migration, @types/google.picker, auth Zod parsing, the first pass on hot endpoints, and the admin type derivation in PR #768.

Still open

April item 5 (G1) -- type tests. Zero expectTypeOf / assertType calls repo-wide. Vitest supports this natively. Highest leverage of the five: type tests are what stop the rest of this backlog from quietly regressing between audits. 1-2 hours.

April item 4 (H1/G4) -- checklist registry as a discriminated map plus satisfies. Still Record<string, ChecklistMetadata> in checklist-registry/index.ts, which widens the keys to string and loses the AMSTAR2 | ROB2 | ROBINS_I union. 2-3 hours.

April item 3 (C1) -- admin and billing endpoints. 96 as Record<string, unknown> casts remain across 31 files. PR #768 handled the admin pages via createServerFn; the older hand-rolled endpoints did not move. Half a day.

April item 7 (G5) -- verbatimModuleSyntax: true. Still false in packages/web/tsconfig.json:12. Mostly lint-autofixable. 1-2 hours.

April item 8 (H4) -- server.ts env typing. Six as never / env as SentryEnv / env as DOEnv casts remain in packages/web/src/server.ts. Casting to never signals the binding type is too narrow at the source. 1 day, lower priority -- not actively dangerous.


Reference implementation for the type tests

cf-sync-engine already does this, in a repo we own. Three files carry 23 expectTypeOf / assertType assertions:

  • packages/protocol/test/schema.test.ts
  • packages/protocol/test/inference.test.ts
  • packages/client/test/collection.test.ts

They mix runtime and type assertions in the same describe block (expect(() => defineSchema({...})).toThrow(...) alongside expectTypeOf), which is the pattern to copy -- no separate .test-d.ts harness needed, and no extra tooling beyond the Vitest already in use.


Part of #778 (TypeScript correctness target state and tracker).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtInternal quality work with no direct user-facing story

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions