Skip to content

feat: improve type-test error messages to be actionable #53

Description

@martyy-code

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

  • Error messages show expected vs received type in plain terms
  • For array/object mismatches: show the index/key that diverges
  • For union mismatches: show which union member was expected
  • Configurable verbosity (terse / detailed)

Risks

  • Low. TypeScript's error API is stable. Start with string/regex rewriting.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiChainable API (check / assert / expect)area:vitestVitest matchers & setupenhancementNew feature or request

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions