Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help: How to reference the definition file? #346

Closed
kabua opened this issue Nov 15, 2018 · 5 comments
Closed

Help: How to reference the definition file? #346

kabua opened this issue Nov 15, 2018 · 5 comments
Labels

Comments

@kabua
Copy link

kabua commented Nov 15, 2018

I hope this is a dumb TS 101 question, but we can't seem to figure it out.

We are porting the the following code snippet to TypeScript:

this._popup = cordova.InAppBrowser.open(params.url, this.target, this.features);

However, we are getting the following error:

[ts] Property 'InAppBrowser' does not exist on type 'Cordova'. [2339]

Therefore we ran:

npm i -D cordova-plugin-inappbrowser

Okay, we now have access to the ...\cordova-plugin-inappbrowser\index.d.ts file but the issue still exists. We've tried all kinds of ways to using import but nothing seam to be working.

What are we doing wrong?

As a work-a-round we are doing this:

const localCordova = <any> cordova;
this._popup = localCordova.InAppBrowser.open(params.url, this.target, this.features);

Thanks.

@janpio janpio added the support label Nov 15, 2018
@jcesarmobile
Copy link
Member

/// <reference types="cordova-plugin-inappbrowser" />

@g-mack
Copy link

g-mack commented Dec 11, 2018

Hi, I have the same problem after removing depricated npm package "@types/cordova-plugin-inappbrowser".

I already tried
/// <reference types="cordova-plugin-inappbrowser" />
which correctly imports relevant type information, but
cordova.InAppBrowser
throws exception "Property 'InAppBrowser' does not exist on type 'Cordova'."

I checked the index.d.ts files in your repository and saw that there was an update to the file 2 month ago which added

interface Cordova { InAppBrowser: InAppBrowser; }

but I think this version is not yet pushed to NPM?

BR,

Gerhard

@janpio
Copy link
Member

janpio commented Dec 11, 2018

Latest release is from April.

@g-mack
Copy link

g-mack commented Dec 12, 2018

@janpio: Do you mean to confirm the issue that the current version on NPM is not the latest or do you contradict?

@jcesarmobile
Copy link
Member

You can check the package details here
https://www.npmjs.com/package/cordova-plugin-inappbrowser

as you can see, latest release was 8 months ago, so yeah, those changes are not released yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants