Skip to content

v0.36.2

Choose a tag to compare

@metonym metonym released this 08 Aug 17:06
· 136 commits to main since this release
v0.36.2
d23bdbc

Fixes

  • infer concise @default for function-identifier props (4252252)

Concise @default for function props

export let x = someFn never produced a default when someFn was a function declaration or a const arrow/function expression. Identifier resolution only pulled JSDoc off the declaration, and the .d.ts writer unconditionally suppressed @default for any function-typed prop — leftover from #203, which stopped dumping full function bodies into docs.

A new helper renders a function default as arrow shorthand (for example () => true or (value) => String(value)) only when the body is trivial: an expression-bodied arrow, an empty block, or a single return <expr>;. Anything with side effects, multiple statements, or no return still gets no @default, so the anti-clutter intent of #203 stays intact. The writer now suppresses @default for function props only when no concise value was inferred.

Two related correctness gaps landed with the same change: async was silently dropped from async arrow defaults, and object-literal returns needed parentheses so they read as an expression instead of a block.