Skip to content

navigator.share should be an optional attribute #957

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

Open
ghost opened this issue Nov 24, 2020 · 0 comments
Open

navigator.share should be an optional attribute #957

ghost opened this issue Nov 24, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 24, 2020

navigator.share should be an optional attribute of Navigator because a significant number of browsers still don't support it (CanIUse), but it seems to be defined as always defined on the navigator interface. So, the following code:

//...
          <Tooltip
            title={
              navigator.share ? "Share" : "Your device doesn't support sharing"
            }
          >
//...

which is perfectly fine raises the following error:

This condition will always return true since the function is always defined. Did you mean to call it instead?  TS2774
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

0 participants