Description
When a type test fails, the TypeScript compiler error is cryptic (e.g. Type 'string | number' is not assignable to type '"a" | "b"'). Add a translation layer that renders actionable error messages: which key is missing, which type is wrong, what the expected shape was.
Why
Cryptic errors are the #1 reason developers give up on type testing. If a failing test produces a readable error, developers can fix it without deep TS knowledge. This is a DX multiplier.
Acceptance criteria
Risks
- Low. TypeScript's error API is stable. Start with string/regex rewriting.
Related
Description
When a type test fails, the TypeScript compiler error is cryptic (e.g. Type 'string | number' is not assignable to type '"a" | "b"'). Add a translation layer that renders actionable error messages: which key is missing, which type is wrong, what the expected shape was.
Why
Cryptic errors are the #1 reason developers give up on type testing. If a failing test produces a readable error, developers can fix it without deep TS knowledge. This is a DX multiplier.
Acceptance criteria
Risks
Related
expectTypeOf(A).toEqualTypeOf<B>()does not cause Vitest to fail tests mmkal/expect-type#148