ReviewOS

stacks/stx

stx typecheck rejects priority="true" for a boolean component prop that the runtime accepts

#2141
Closed chris opened this 2 days ago ·
2 days ago

What happens

A component declares priority?: boolean. Passing it the HTML-style way, <ShowcaseFigure priority="true" />, builds and renders fine, but stx typecheck fails:

resources/views/index.stx:57:353  error TS1360  Type '"true"' does not satisfy the expected type 'boolean | undefined'.  [template: "true"]

The CI typecheck gate of the Settlers III remake went red on this.

Expected

A boolean prop given as a plain "true"/"false" (or bare) attribute should either typecheck, matching what the runtime accepts, or the runtime should reject it too. Today the two disagree. The workaround is :priority="true".

stx 0.2.756.

Sign in to comment on this issue.