Reputation: 51
Checked these links:
But I couldn't seem to understand this behavior.
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
.
Upvotes: 3
Views: 1381
Reputation: 176
I also faced this issue. For me, the problem was that I used:
<script lang="ts">
but, Composition API style. The correct one should be:
<script setup lang="ts">
(The "setup" part was missing.)
Upvotes: 0
Reputation: 12018
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
Upvotes: 1