-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Component props can be defined as a string #2304
Copy link
Copy link
Closed
Description
Describe the bug
ComponentType<Props> can be defined where Props is a string.
Component types that contains strings cannot be consumed via JSX.
const First: ComponentType<string> = (props) => null
const First = (props: string) => null
//@ts-expect-error
const Second = () => <First />Error when hovering over second
Type '{}' is not assignable to type 'IntrinsicAttributes & string'.
Type '{}' is not assignable to type 'string'.(2322)
Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-wb1s7a?file=src%2FApp.tsx&view=editor
Steps to Reproduce the Bug or Issue
Go to the stack blitz url.
Expected behavior
Component props shouldn't be strings, since they can't be used in JSX.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Firefox
- Version: ^1.8.20 (1.8.22)
Additional context
Problem is that {} === string.
I think this should instead be object, Record<string, any> or Record<string, unknown>.
Not sure which though.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels