Skip to content

chore: tighten typings across the app - #29

Merged
thinkclay merged 1 commit into
mainfrom
codex/cleanup-typescript-any-usages-mn7qu6
Sep 23, 2025
Merged

thinkclay merged 1 commit into
mainfrom
codex/cleanup-typescript-any-usages-mn7qu6

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Summary

  • add typed helpers for input variants to eliminate any casts and preserve font token handling
  • update the date picker components to forward props safely and remove loose typings
  • clean up remaining any usages in theme utilities, providers, and scripts while addressing lint warnings

Testing

  • yarn lint

https://chatgpt.com/codex/tasks/task_b_68d20667ce808331aa2614093b0325af

@thinkclay
thinkclay merged commit 79878c4 into main Sep 23, 2025
@thinkclay
thinkclay deleted the codex/cleanup-typescript-any-usages-mn7qu6 branch September 23, 2025 02:56
thinkclay added a commit that referenced this pull request Sep 11, 2026
…type can catch

Some routes wrap their success body in `{ data }` and some return it bare. The
http client returns the parsed body verbatim, so a method declaring
`Promise<UserProfile>` against a wrapping route actually resolves to
`{ data: UserProfile }`. TypeScript never notices, because the generic is
asserted — `this.get<UserProfile>(...)` — rather than inferred from the wire.
And the msw handlers are written from the declared types, so the suite agrees
with the type while the type disagrees with the API.

That combination has produced three wrong contracts a green suite certified:
Scaffald/sdk#21 (employers), #26 (organizations), #29 (getUser). The check has
to compare the route to the SDK, because comparing either to a fixture cannot
see it.

sdk-envelopes.test.ts parses both sides and fails on any pair that disagrees,
with a baseline enforced in both directions like its sibling — a new mismatch
fails, and so does a stale entry.

**11 genuine mismatches are baselined.** Which side moves is a public-API
decision (#744), not something to settle inside a test.

Getting that number right took three corrections, all of which are why the
guard looks the way it does:

  * "has a top-level `data` key" is too loose. It classified
    PrerequisitesCheckResponse as wrapped — that type has a `data` field among
    a dozen domain fields — and a live probe of /v1/prerequisites/check
    confirmed the body is bare. An envelope is `data` plus nothing but
    pagination/metadata keys.

  * 39 SDK methods across six resources unwrap the envelope themselves
    (`const res = await this.get<X>(p); return res.data`). Their declared type
    describes the inner payload and is correct *because* the route wraps.
    Comparing their declared type to the route reported all of them as broken;
    11 of my first 22 baseline entries were this false positive.

  * `return c.json({ data }, 200)` is shorthand for `{ data: data }`. Requiring
    a colon to read a key called two correct routes bare.

Verified by attacking it rather than trusting a green run: flipping
legal.getCurrent to an envelope fails with "sdk says wrapped, route says bare",
and adding a baseline entry for a pair that agrees fails with "now agrees;
remove it". Both pass again once reverted.

Also bumps the sdk pointer to pick up #28 and #29. #743 should have carried
`git submodule update --init --recursive` and reset the submodule back to the
recorded commit after I had checked out the merged one. So main has been
carrying the honest route schema from #743 with the SDK type that contradicts
it.

Refs #744

Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay added a commit that referenced this pull request Sep 11, 2026
…type can catch (#746)

Some routes wrap their success body in `{ data }` and some return it bare. The
http client returns the parsed body verbatim, so a method declaring
`Promise<UserProfile>` against a wrapping route actually resolves to
`{ data: UserProfile }`. TypeScript never notices, because the generic is
asserted — `this.get<UserProfile>(...)` — rather than inferred from the wire.
And the msw handlers are written from the declared types, so the suite agrees
with the type while the type disagrees with the API.

That combination has produced three wrong contracts a green suite certified:
Scaffald/sdk#21 (employers), #26 (organizations), #29 (getUser). The check has
to compare the route to the SDK, because comparing either to a fixture cannot
see it.

sdk-envelopes.test.ts parses both sides and fails on any pair that disagrees,
with a baseline enforced in both directions like its sibling — a new mismatch
fails, and so does a stale entry.

**11 genuine mismatches are baselined.** Which side moves is a public-API
decision (#744), not something to settle inside a test.

Getting that number right took three corrections, all of which are why the
guard looks the way it does:

  * "has a top-level `data` key" is too loose. It classified
    PrerequisitesCheckResponse as wrapped — that type has a `data` field among
    a dozen domain fields — and a live probe of /v1/prerequisites/check
    confirmed the body is bare. An envelope is `data` plus nothing but
    pagination/metadata keys.

  * 39 SDK methods across six resources unwrap the envelope themselves
    (`const res = await this.get<X>(p); return res.data`). Their declared type
    describes the inner payload and is correct *because* the route wraps.
    Comparing their declared type to the route reported all of them as broken;
    11 of my first 22 baseline entries were this false positive.

  * `return c.json({ data }, 200)` is shorthand for `{ data: data }`. Requiring
    a colon to read a key called two correct routes bare.

Verified by attacking it rather than trusting a green run: flipping
legal.getCurrent to an envelope fails with "sdk says wrapped, route says bare",
and adding a baseline entry for a pair that agrees fails with "now agrees;
remove it". Both pass again once reverted.

Also bumps the sdk pointer to pick up #28 and #29. #743 should have carried
`git submodule update --init --recursive` and reset the submodule back to the
recorded commit after I had checked out the merged one. So main has been
carrying the honest route schema from #743 with the SDK type that contradicts
it.

Refs #744

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant