orenelbaum / babel-plugin-solid-undestructure

A Babel plugin for SolidJS that allows you to destructure component props without losing reactivity.
95 stars 3 forks source link

feat: support `VoidComponent` type annotation #15

Closed nathanbabcock closed 1 year ago

nathanbabcock commented 1 year ago

Description

VoidComponent is another SolidJS type alias mentioned on https://www.solidjs.com/guides/typescript#component-types. It's a shorthand for a component that has no children prop, and therefore could be written as self-closing in JSX (e.g. <img />).

// from solid-js type definitions:
type VoidProps<P = {}> = P & { children?: never };
type VoidComponent<P = {}> = Component<VoidProps<P>>;

Changes

orenelbaum commented 1 year ago

Awesome, thanks!