Skip to content

Type keyword support#89

Merged
cs01 merged 3 commits intomainfrom
type-keyword-support
Mar 5, 2026
Merged

Type keyword support#89
cs01 merged 3 commits intomainfrom
type-keyword-support

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 5, 2026

Summary

  • type Foo = { ... } now fully supported as an equivalent to interface Foo { ... } for defining object shapes — including method signatures, which were previously silently dropped from type aliases in both parsers
  • Docs updated to prefer type syntax in all examples (README, fetch, json, object, classes, features)

Changes

Parser fixes (src/parser-native/transformer.ts, src/parser-ts/transformer.ts):

  • type Foo = { method(): void } — method signatures in type aliases now parsed and registered, matching interface behavior
  • Both the TS and native parsers updated

Tests (tests/fixtures/interfaces/):

  • type-alias-object.ts — nested type alias access
  • type-alias-json-parse.tsJSON.parse<T>() with a type alias
  • type-alias-optional.ts — optional fields in type aliases

Test plan

  • All 276 unit tests pass (npm test)
  • type Foo = { ... } works interchangeably with interface Foo { ... } for field access, JSON.parse<T>(), optional fields, and method signatures

@cs01 cs01 force-pushed the type-keyword-support branch from 00ef920 to 38818a7 Compare March 5, 2026 01:57
@cs01 cs01 merged commit 5e46231 into main Mar 5, 2026
12 checks passed
@cs01 cs01 deleted the type-keyword-support branch March 5, 2026 02:04
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