-
Notifications
You must be signed in to change notification settings - Fork 208
fix(typings): allow to have primitives as children for built-in #369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1926,7 +1926,7 @@ export interface CSSPropertiesLossy { | |
| undefined | ||
| Array<CSSPropertiesComplete[keyof CSSPropertiesComplete]> | ||
| CSSPropertiesLossy | ||
| React.ReactChild | ||
| React.ReactNode | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the update, I'd love to remove this entirely from this file as a ReactNode/ReactChild is not a css property. But keeping things working in the meantime sounds great 💯. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Me too, but small steps at a time. :-( I have tried investigating the root cause, but I can not understand why does |
||
} | ||
|
||
export interface CSSProperties | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this was removed by accident as it looks like it should fail and appears unrelated to the changes. Would you mind re adding if that's the case thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed on purpose, as this relaxation is the side-effect of the proposed change.
The new indexed type allows the value to be boolean, which makes the
primaryColor: props.visible
be valid.Of course, it’s silly that we have this effect, but as noted in the other comment, it’d be awesome to not even have
children
in theCSSProperties
. Until then this is a workaround.The PR is effectively relaxing the type-checking for this instance, meaning fewer errors will be caught by TypeScript compiler. However, requirements that are too lax are much better than requirements that are too strict. In the latter case the developers fall into habit into silencing errors (with
as any
), defeating the entire purpose of typechecking in the first place.