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

Typings for 5.0.0 export only isEnabled #166

Closed
DirtyHairy opened this issue Jan 12, 2020 · 2 comments
Closed

Typings for 5.0.0 export only isEnabled #166

DirtyHairy opened this issue Jan 12, 2020 · 2 comments

Comments

@DirtyHairy
Copy link

DirtyHairy commented Jan 12, 2020

The current typings for 5.0.0 render the library unusable without an explicit cast. The typings read

interface Screenfull {
     // [...]
    readonly isEnabled: boolean;
     // [...]
}

and

declare const screenfull: screenfull.Screenfull | {isEnabled: false};

I suppose the intention is to force a check on isEnabled before the API is accessible; however, this would require the interface to be

interface Screenfull {
     // [...]
    readonly isEnabled: true;
     // [...]
}

With the current typings, the only exported property is isEnabled, rendering the library unusable. The only workaround that I could come up with is an explicit cast:

import _screenfull, { Screenfull } from 'screenfull';
const screenfull = _screenfull as Screenfull;
@DirtyHairy
Copy link
Author

Thanks alot!

@mustafaekim
Copy link

Hi, I still cannot call screenfull.isEnabled but only screenfull.enabled
the typing seems not to be working for me. I am on "screenfull": "^5.0.2"

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

No branches or pull requests

2 participants