Skip to content
Discussion options

You must be logged in to vote

Ripple doesn't have a dedicated ParentComponent alias, but you don't need to spell out children?: JSX.Element by hand either. The built-in helper you want is PropsWithChildrenOptional, and the child type should be Ripple's Children, not JSX.Element.

1. PropsWithChildrenOptional<T> is the closest ParentComponent<T> equivalent

Ripple exports these from the ripple entry:

export type Children = TSRXElement | Component | string | number | boolean | null | undefined;

export type PropsWithChildren<T extends object = {}> = Expand<
  Omit<T, 'children'> & { children: Children }
>;

export type PropsWithChildrenOptional<T extends object = {}> = Expand<
  Omit<T, 'children'> & { children?: Children }

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Borderliner
Comment options

You must be logged in to vote
1 reply
@Borderliner
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants