Skip to content

MyComboBoxProps has incorrect children type in react-aria-component ComboBox docs  #4470

@LFDanLu

Description

@LFDanLu

children type of MyComboBoxProps should be children: React.ReactNode | ((item: T) => React.ReactElement);.
Will need to do a sweep in other places, this may not be the only instance where this type needs to be corrected

Discussed in #4456

Originally posted by mgo-af April 29, 2023
Hello!

Just running through the react-aria-components examples, I run into this TS error when copy-pasting the example into a sandbox.

Type 'ReactNode | ((item: T) => ReactNode)' is not assignable to type 'ReactNode | ((item: T) => ReactElement<any, string | JSXElementConstructor<any>>)'.
  Type '(item: T) => ReactNode' is not assignable to type 'ReactNode | ((item: T) => ReactElement<any, string | JSXElementConstructor<any>>)'.
    Type '(item: T) => ReactNode' is not assignable to type '(item: T) => ReactElement<any, string | JSXElementConstructor<any>>'.
      Type 'ReactNode' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>>'.
        Type 'string' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>>'.ts(2322)
types.d.ts(50, 5): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & ListBoxProps<T> & RefAttributes<HTMLDivElement>'

Here is a sandbox

Metadata

Metadata

Assignees

No one assigned

    Labels

    RACdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions