Repository navigation
Commit ff429d5
committed
test: add compile-time key-parity assertions for spec type checks
Add 151 compile-time key-parity assertions to spec.types.test.ts that
verify SDK and spec types have exactly the same set of named property
keys. This catches missing .optional() parameters that the existing
mutual-assignability checks cannot detect due to TypeScript structural
subtyping.
Introduces three utility types:
- KnownKeys<T>: strips index signatures, keeps named keys only
- AssertExactKeys<A, B>: resolves to true on match, descriptive error
type on mismatch
- Assert<T extends true>: constraint that forces compile error
Coverage: 151 of 174 sdkTypeChecks entries. 23 exclusions documented
(15 union types, 8 primitive aliases).
Discovered 7 genuine SDK/spec key mismatches, documented with
@ts-expect-error annotations as a living drift inventory.
Closes modelcontextprotocol#12981 parent 108f2f3 commit ff429d5
1 file changed
Lines changed: 226 additions & 0 deletions
0 commit comments