Microsoft/TypeScript

navigator.share is not always a function

Open

#42.809 aberto em 15 de fev. de 2021

Ver no GitHub
 (7 comments) (18 reactions) (0 assignees)TypeScript (6.726 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Métricas do repositório

Stars
 (48.455 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)

Description

Bug Report

navigator.share is undefined is many browsers, yet TypeScript reports it as "the function is always defined"

🔎 Search Terms

navigator.share share

🕗 Version & Regression Information

Version 4.1.5 & Nightly

⏯ Playground Link

https://www.typescriptlang.org/play?#code/JYMwBAFAdghgbsA5jALgewE4DoDOALGDAUwEowBvAWACgw6wBjNKHNAGyKzbUQgHIAKniJhYKYHBH5CIkEVQBXYmGA4VAWwAOHdUSgoiAEz4kA3DQC+YImxwiqtekxbtO3XoOGjUEqQWVyisqqomgoGtpEuvpGJubUFkA

💻 Code

if (navigator.share) {
    console.log('The native share feature is implemented');
} else {
    console.log('The native share feature is not implemented');
}

🙁 Actual behavior

TypeScript reports it as "the function is always defined"

🙂 Expected behavior

If should report navigator.share as maybe being present.

Guia do colaborador