Closed robinvw1 closed 2 years ago
I think the better approach would be to keep this variable in the library ("@types/react": "*"
) and apply this yarn resolutions per app. Many users have already switched or will switch to RN 0.69 soon, which includes React 18.
What do you think @robinvw1 ? :)
I agree, @chrispader. :)
It's this the same problem?
Component
cannot be used as a JSX component. Its return type 'ReactNode' is not a valid JSX element.
https://github.com/pmndrs/drei/issues/1059
It's this the same problem?
Component
cannot be used as a JSX component. Its return type 'ReactNode' is not a valid JSX element. https://github.com/pmndrs/drei/issues/1059
yes, if you are using yarn and you're still on RN <0.69 you will have to add
"resolutions": {
"@types/react": "*"
}
to your package.json.
It's this the same problem?
Component
cannot be used as a JSX component. Its return type 'ReactNode' is not a valid JSX element. https://github.com/pmndrs/drei/issues/1059yes, if you are using yarn and you're still on RN <0.69 you will have to add
"resolutions": { "@types/react": "*" }
to your package.json.
oh thanks, it works!
Description
Encountered several weird TypeScript errors, when working in this repository:
Seems @mrousavy encountered the same looking at this
as any
: https://github.com/margelo/react-native-graph/blob/main/src/AnimatedLineGraph.tsx#L29-L30Cause
Tracked down to this https://github.com/facebook/react/issues/24304, stating:
Fix
A comment from a React contributor https://github.com/facebook/react/issues/24304#issuecomment-1094565891 suggests to force
@types/react@*
to your React 17 version by usingoverrides
(npm) orresolutions
(yarn).Even better is to open an issue at the responding library's repo.
@mrousavy I'm fine with closing this PR, because it's a suboptimal fix (and making
package.json
grow even further). In any case, now you know what is causing these errors and this fixes it for the time being. It's your choice.