ReviewOS

stacks/stx

Match runtime event-list declarations and parent payload types

#2123
Closed chris opened this 7 days ago ·
7 days ago

Stacks view type checking currently reports 200 errors with STX 0.2.708. The same event contracts are present on current STX main. A valid defineEmits(['change', 'close']) call fails with TS2554 because ambient declarations only accept zero arguments. Parents using a typed handler for an untyped event list also fail: the component contract treats any[] as an array payload, while the browser exposes the first emitted payload as $event.

The source fix adds a runtime event-list overload matching the existing dynamic event-forwarding API and unwraps an unbounded event argument list to its first payload. Explicit tuple event contracts retain their existing checks. A real checker regression covers valid array declarations, dynamic forwarding and parent handler references, plus rejection of wrong names and payloads in explicit typed contracts; existing typed-payload rejection remains covered.

Acceptance: checker regression red/green, full STX release gates, published package verification, and zero errors when normally installed by Stacks for its 496 view files. This blocks publishing the browser scale fix tracked in stacksjs/stacks#3019.

7 days ago

Fixed in STX 0.2.711. Runtime event lists now type-check, and parent handlers receive the emitted payload type. Explicit typed event contracts still reject wrong event names and payloads.

The published archive matches the reviewed event declarations and contains the checker fix. Installing the released cohort in Stacks reduced its view checks from 200 errors to zero across 505 script blocks and 8,829 template expressions in 496 files. The 251 checker tests, release preflight and full release-source suite passed. Main CI is green; the full source suite passed 17,223 tests with no failures.

Sign in to comment on this issue.