【发布时间】:2018-11-30 10:02:08
【问题描述】:
检查了这些链接:
- 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
但我似乎无法理解这种行为。
转载:
git clone https://github.com/the-joat/rn-maps-ts-bug-demo
cd rn-maps-ts-bug-demo
yarn
yarn build
Typescript 将成功编译,但我想抑制您在 Qwerty.tsx 中看到的错误。
我尝试使用 .d.ts 文件:
import MapView from "react-native-maps"
declare module "react-native-maps" {
const a: any
export default a
}
但它引发了另一个错误,我认为这不是一个真正的永久解决方案,因为我将无法从 react-native-maps 中声明的类型中受益。
【问题讨论】: