小编Sug*_*esh的帖子

使用Typescript 2.8反应Native - 无法重新声明块范围变量'console'

使用Typescript创建了一个react-native入门项目,可以在2周前运行.现在,当我尝试运行项目时,它会在打字稿编译过程中出错.

skipLibraryCheck: true在tsconfig.json中使用可修复错误.但是为什么它会从〜/ .nvm和./node_modules目录中抛出错误?

错误(针对node_modules/.bin/tsc更新):

>  node_modules/.bin/tsc
node_modules/@types/react-native/index.d.ts(8742,11): error TS2451: Cannot redeclare block-scoped variable 'console'.
node_modules/@types/react-native/index.d.ts(8750,18): error TS2717: Subsequent property declarations must have the same type.  Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'.
node_modules/@types/react-native/index.d.ts(8753,11): error TS2451: Cannot redeclare block-scoped variable 'navigator'.
node_modules/redux-thunk/index.d.ts(4,47): error TS2314: Generic type 'Dispatch<A, S>' requires 2 type argument(s).
node_modules/redux-thunk/index.d.ts(8,20): error TS2428: All declarations of 'Dispatch' must have identical type parameters.
node_modules/redux/index.d.ts(115,18): error TS2428: All declarations of 'Dispatch' must have identical …
Run Code Online (Sandbox Code Playgroud)

typescript react-native

11
推荐指数
1
解决办法
3700
查看次数

标签 统计

react-native ×1

typescript ×1