-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
typescriptTypescript enhancements and bugsTypescript enhancements and bugs
Description
Expected Behavior
When using the List
component in TS with a render prop function as props.children
, the types should be correctly inferred, either from an explicit passing of the generic type or inference from the passing of typed data.
Actual Behavior
The types for props.children
seem to have been set in such a way that inference expects a union of (((...args: any[]) => Element) & (string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null)) | undefined
.
URL, screen shot, or Codepen exhibiting the issue
In the current state, it seems that typescript expects a string for the children prop.
When passing a string as recommended above, TypeScript provides a more useful response showing the intersection type expected.
Steps to Reproduce
See screenshots above - PR with fix incoming
Your Environment
- Grommet version: 2.35.0
- TypeScript version: 4.9.5
Metadata
Metadata
Assignees
Labels
typescriptTypescript enhancements and bugsTypescript enhancements and bugs