Skip to content

refactor: structure TypeScript error classes - #163

Open
adamcavendish wants to merge 1 commit into
adamcavendish/typescript-api-interface-emissionfrom
adamcavendish/typescript-error-class-emission
Open

adamcavendish wants to merge 1 commit into
adamcavendish/typescript-api-interface-emissionfrom
adamcavendish/typescript-error-class-emission

Conversation

@adamcavendish

Copy link
Copy Markdown
Collaborator

Summary

Migrate generated TypeScript Fetch error classes from formatted declaration fragments to structural TypeSpec, FieldSpec, and FunSpec emission.

Problem

Error classes were still assembled as raw source alongside their detail aliases. That left inheritance, readonly fields, constructors, and response-header methods outside the structured sigil-stitch declaration pipeline.

Behavior

Surface Result
Error classes ResponseError inheritance, readonly detail, constructor assignment, and default message are emitted structurally.
Error headers Error response-header accessors are attached as structured class methods.
Generated API Error class names, exports, runtime behavior, and non-whitespace generated output remain unchanged.
Formatting Constructor wrapping and surrounding declaration spacing follow structured sigil-stitch rendering.
Detail aliases Anonymous error-detail union aliases remain unchanged pending inline object/record type support in sigil-stitch.

Compatibility and boundaries

- Emit generated error classes through TypeSpec, FieldSpec, and FunSpec while
  preserving ResponseError inheritance, readonly details, constructors, and
  response-header accessors.
- Keep anonymous error-detail aliases unchanged until sigil-stitch supports
  inline object or record type names instead of adding a raw-source workaround.
- Pin the structured class and header-method rendering and synchronize the
  resulting TypeScript golden layout without changing non-whitespace output.
@adamcavendish
adamcavendish added this pull request to stack #162 October 23, 2026 16:24

This branch has not been deployed

No deployments
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