My problem is that I'm using an old type declaration package (@types/expo
). So that's why I need to update some part of it. I created a new typing file like this. (./typings/expo/index.d.ts
)
import * as expo from 'expo';
declare module 'expo' {
var Icon: any;
var SplashScreen: any;
export interface AppLoadingProps {
startAsync?: () => Promise<void[]>;
}
}
Some parts were started to work but also I started to get this error:
[ts] Subsequent property declarations must have the same type.
Property 'startAsync' must be of type '(() => Promise<void>) | undefined',
but here has type '(() => Promise<void[]>) | undefined'
I searched it on google and typescript forums but It doesn't have any meaningful answer for this. Is it possible to update the interface that has same props? Or do I need to wait until the company updates its package on definitelyTyped
?
my tsconfig.json file;
{
"compilerOptions": {
"target": "ES2017",
"module": "es2015",
"lib": [ /* Specify library files to be included in the compilation. */
"es2017",
"dom"
],
"jsx": "react-native",
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"moduleResolution": "node",
"typeRoots": [ /* List of folders to include type definitions from. */
"./typings",
"./node_modules/@types"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noEmitHelpers": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"outDir": "build/dist"
},
"exclude": [
"build",
"node_modules"
],
"types": [
"typePatches"
]
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…