github PerryTS/perry v0.5.109
v0.5.109 — perry init type stubs + UI docs

latest releases: v0.5.1220, v0.5.1219, v0.5.1206...
3 months ago

Bug Fixes

  • perry init TypeScript type stubs were broken for non-numeric State (closes #103). types/perry/ui/index.d.ts:

    • State is now generic (State<T = number>). State<string[]>([]) and State("") from the docs now type-check instead of erroring on the old number-only signature.
    • Added the ForEach(count: State<number>, render) export — it was used in the docs todo-app example but missing from the stub.
    • stateBindTextfield now takes State<string> to match its purpose.
  • UI docs examples called a TextField(state, placeholder) form that didn't exist and segfaulted at launch. UiArgKind::Str at crates/perry-codegen/src/lower_call.rs:2557 routes the first arg through get_raw_string_ptr, so a State handle (i64) reinterpreted as a NaN-boxed string derefs garbage. Rewrote the examples in:

    • docs/src/getting-started/first-app.md — counter + todo app
    • docs/src/ui/state.md — two-way binding, onChange, complete example
    • docs/src/ui/widgets.mdTextField / SecureField / Toggle / Slider / Picker / Form
    • docs/src/ui/dialogs.md — the text-editor TextField line

    to use the actual runtime signatures: TextField(placeholder, onChange), Slider(min, max, onChange), Picker(onChange) + pickerAddItem, etc. .onChange method replaced with the free-function stateOnChange(state, cb).

Verified

5 example binaries built from the corrected docs (counter, todo, controls, form, onchange) pass tsc --noEmit against the regenerated stubs AND compile + launch without crashing via perry src.ts -o bin.

No runtime/codegen change — stubs are embedded into the perry binary via include_str! at compile time and ship to users through perry init / perry types.

Don't miss a new perry release

NewReleases is sending notifications on new releases.