-
Notifications
You must be signed in to change notification settings - Fork 208
typescript: built-in components don't accept Components as children #304
Comments
To add more information, currently only built-in components with single JSX child failes to pass type checking.
fails with error
However, all of the following works without error:
Personally, I suspect that there's something more going on other than strictness of |
<glamorous.Div>
<glamorous.Span>Hello,</glamorous.Span>
<glamorous.Span>world!</glamorous.Span>
</glamorous.Div> I suspect this passes currently because;
|
@luke-john
I think 3 doesn't apply to partial type, like CSSProperties for our case. |
Im on mobile till tmo, but the following should demonstrate the issue with interface Foo { foo?: number; }
const x: Foo = () => 'passes';
const y: {} = { bar: 'asdf' }; Edit: redid comment as email replies do not support markdown |
TypeScript says that
|
I am experiencing the same problem as @Antontelesh glamorous@4.11.4, typescript@2.7.1, glamor@2.20.40 with the following:
|
@Antontelesh @deep-c Currently, we are trying to remove |
Originally reported by @Kais-DkM at #303.
What you did:
Used a Component as a child of a built in glamorous component
What happened:
Typescript errored with
Type '{ children: Element; }' is not assignable to type 'CSSPropertiesDom'.
Problem description:
The index type for CSSPropertiesLossy is too strict for glamorous component factories
Suggested solution:
Use a custom version of CSSProperties with built in component factories along the following lines
Other Notes:
For anyone tackling this issue it would be great to add some tests for the built in component factories.
The text was updated successfully, but these errors were encountered: