1
votes

Full error message:

Interface 'InAppBrowser' incorrectly extends interface 'Window'. Types of property 'addEventListener' are incompatible. Type '{ (type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; (type: "loadstop", cal...' is not assignable to type '{ (type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; (type...'. Types of parameters 'type' and 'type' are incompatible. Type '"batterystatus"' is not assignable to type '"loadstart"'.

My TypeScript Cordova project compiled fined before I installed TypeScript 2.4.1 for Dev14. Now I get above error.

3

3 Answers

1
votes

Update the following Cordova DTS files with content in the corresponding link to the Definitely Typed GitHub. Copy and paste contents of corresponding files

This is a breaking change as in TypeScript 2.4 we change how variant work in callback parameter. More detail here

0
votes

I face this issue in Apache Cordova in Visual Studio and tried to solve it by updating cordova from Update and extenstions link.

0
votes

This solution worked for me: https://stackoverflow.com/a/57972192/10058447

Added "skipLibCheck": true in tsconfig.json:

"compilerOptions": {
    "baseUrl": "./",
    "target": "es5",
    "skipLibCheck": true
}