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
I am using pretty old version of the lib (1.3.3) and tried to upgrade that in the project but one of the problems is that the type of the _uid was changed at some point from _uid: string; to _uid?: string;.
I am using it in the project everywhere when enumerating children.
Is this a typing issue or the _uid can be actually in some cases undefined and I should update the project to stop using that as a React key?
Same with component: TComp; is now: component?: T; - so I cannot be sure that the component will be always set?
I know this is the code from storyblok-js-client but it has direct impact on this lib and I am wondering how to solve that.
marekrozmus
changed the title
Cannot use the _uid as a React key in Typescript as the field has type string | undefined
Usage of the _uid as a React key? - the field has type string | undefined
Apr 14, 2024
Describe the issue you're facing
I am using pretty old version of the lib (1.3.3) and tried to upgrade that in the project but one of the problems is that the type of the
_uid
was changed at some point from_uid: string;
to_uid?: string;
.I am using it in the project everywhere when enumerating children.
Is this a typing issue or the
_uid
can be actually in some casesundefined
and I should update the project to stop using that as a Reactkey
?Same with
component: TComp;
is now:component?: T;
- so I cannot be sure that the component will be always set?I know this is the code from
storyblok-js-client
but it has direct impact on this lib and I am wondering how to solve that.Reproduction
https://github.com/storyblok/storyblok-js-client/blob/644fd93eae990a9f0e36c59c68aa9fab9d81469a/src/interfaces.ts#L76
Steps to reproduce
No response
System Info
Used Package Manager
npm
Error logs (Optional)
No response
Validations
The text was updated successfully, but these errors were encountered: