You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Types of property 'key' are incompatible.
Type 'Key | null | undefined' is not assignable to type 'Key | undefined'.
Type 'null' is not assignable to type 'Key | undefined'.
<Note {...props}>
~~~~
Digging into the NoteProps we can see that it takes key?: React.Key:
React.Key is a type for string | number. If we dig into @types/react we find this:
/** * @internal You shouldn't need to use this type since you never see these attributes * inside your component or have to validate them. */interfaceAttributes{key?: Key|null|undefined;}
...
So as you can see, our types are removing the ability to set key to null. I don't think we should be redefining this at all.
The text was updated successfully, but these errors were encountered:
Forma 36 bug report
Summary
The types returned for our components seem to override React's default
key
type, which allowsnull
. Ours do not.Details
I'm not sure how to share typescript examples that actually show type errors, so I will have to share a simple example the manual way:
Typescript will complain about this:
Digging into the NoteProps we can see that it takes
key?: React.Key
:React.Key
is a type forstring | number
. If we dig into@types/react
we find this:So as you can see, our types are removing the ability to set
key
to null. I don't think we should be redefining this at all.The text was updated successfully, but these errors were encountered: