Releases: aikmandean/st
Objects no longer automatically optional
Type signature update for objects (unreleased)
Changing how objects are compared to the editor. A type-level only change.
Explanation
Before the release of the builtin metadata "default", no props were nullable. After the update, all objects are nullable by default. This marks the reverting change back to non-nullable for objects. Objects can be nullable by using HasFallback
or passing default: true
to defineProp
.
Status
Unreleased to NPM
Code Example
const Person = defineProp({ age: 0 })
const OptionalPerson = defineProp({ age: 0 }, { default: true })
Objects, or any type, can still be optional by passing default: true
. Objects are no longer optional automatically.
New benefits to defining callbacks
Type signature update for first-class functions (equivalent)
Makes defineProp more useful to require callbacks as a prop. A type-level only change.
Explanation
Before this release, callbacks could not be defined if at any point fn
was used to template the callback. After the update, functions defined in fn
are stripped of their composability if passed to defineProp
. Functions are still composable, but defined callbacks are not.
Status
Equivalent to NPM release 1.0.4
Code Example
const Count = defineProp(0)
const CallbackUsingCount = defineProp(fn(props => {}, { Count }))
const fetchCount = fn(props => {
props.callbackUsingCount({ count: 100 })
}, { CallbackUsingCount })
Because defined callbacks aren't composable, props requires callback callbackUsingCount
whereas it previously composed away the callback into its required props (count
).