Issue
Checked these links:
- Typescript error Property does not exist on type
- property then does not exist on type void , A typescript error
- Typescript property does not exist on type {}
- TypeScript: suppress Property does not exist on type
- TS2339: Property does not exist on type
- https://github.com/Microsoft/TypeScript/issues/1574
But I couldn't seem to understand this behavior.
Reproduce:
git clone https://github.com/the-joat/rn-maps-ts-bug-demo
cd rn-maps-ts-bug-demo
yarn
yarn build
Typescript will successfully compile but I want to suppress the error you'll see in Qwerty.tsx
.
I've tried having a .d.ts
file that has:
import MapView from "react-native-maps"
declare module "react-native-maps" {
const a: any
export default a
}
but it's throwing another error and I don't think it's really a permanent solution since I won't be able to benefit from the types declared in react-native-maps
.
Solution
It looks like the react and react-native type definitions are missing from the project. Those types are required to properly recognize the props of JSX elements. Try installing them:
yarn add --dev @types/react @types/react-native
Answered By - kingdaro
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.