-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Provide a general summary of the issue here
I'm upgrading to the latest version of @adobe/react-spectrum and encountering several TypeScript errors when using the TabList and TabPanels components. This seems to be due to improper return types in the library’s type definitions, similar to previous issues reported with DismissButton and OverlayProvider in React Aria.
🤔 Expected Behavior?
There should be no type errors when using TabList and TabPanels components as JSX elements in React with TypeScript.
😯 Current Behavior
'TabList' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
Type 'string' is not assignable to type 'ReactElement<any, any>'.
'TabPanels' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
Type 'string' is not assignable to type 'ReactElement<any, any>'.
💁 Possible Solution
The return types of TabList and TabPanels should be updated from ReactNode to ReactElement.
🔦 Context
The issue mirrors a previously reported problem in the react-aria repo where DismissButton and OverlayProvider had incorrect return types. Tabs were not included in that fix 8099 .
🖥️ Steps to Reproduce
- Install and use @adobe/react-spectrum
- Try to render the TabList and TabPanels components as JSX
- Observe the TypeScript errors
`'TabList' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
Type 'string' is not assignable to type 'ReactElement<any, any>'.
'TabPanels' cannot be used as a JSX component.
Its return type 'ReactNode' is not a valid JSX element.
Type 'string' is not assignable to type 'ReactElement<any, any>'.
`
Version
3.43.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
MAC OS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response