My issue arises from using an outdated type declaration package (@types/expo
). To resolve this, I decided to update certain aspects of it by creating a new typing file like so: ./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[]>;
}
}
While some parts have begun functioning correctly, I've encountered the following 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'
Despite searching on Google and TypeScript forums, I haven't found a satisfactory solution for this issue. Should I attempt to modify the interface with identical properties, or wait for the package to be updated on definitelyTyped
?
Here is a glimpse of my tsconfig.json file:
{
"compilerOptions": {
"target": "ES2017",
"module": "es2015",
"lib": [
"es2017",
"dom"
],
"jsx": "react-native",
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"moduleResolution": "node",
"typeRoots": [
"./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"
]
}