Skip to content

Add type-level test harness (pnpm test:types) - #27

Closed
kac-axelor wants to merge 1 commit into
axelor:devfrom
kac-axelor:type-level-tests
Closed

kac-axelor wants to merge 1 commit into
axelor:devfrom
kac-axelor:type-level-tests

Conversation

@kac-axelor

@kac-axelor kac-axelor commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Adds a vitest typecheck suite (pnpm test:types) that pins the client API's type contract — 38 cases covering where/select/orderBy/aggregate shapes, payload narrowing to selections, mutation inputs, and rejection of unknown keys at every nesting depth. No database needed: the client is declared and only tsc runs.

Two cases fail by design — they specify intended behavior that lands in follow-up PRs:

  • Nested creates must not require the mappedBy field the ORM auto-fills from the parent record (callers currently pass a dummy contact: {}).
  • Additionally, once TypeScript 6.0 lands, the nested excess-key negatives go red until the Options<> guard fix: TS 6.0's inference change silently accepts unknown keys in nested positions.

The suite is intentionally not wired into CI yet; it goes green over the course of the series and can be added to CI afterwards.


Series (merge order): #27 type tests (red by design) → #28 TypeScript 6.0 upgrade → #29 Options<> guard fix → #30 mappedBy fix. The suite in #27 goes fully green once all four are merged.

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