TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Add UserActivation interface to Navigator interface in lib.dom.d.ts

Open morganney opened this issue 3 years ago • 4 comments

I'm using tsc 4.8.4 and there is no support for navigator.userActivation. This is now part of the HTML Living Standard and implemented by Chrome, Edge, and Opera browsers.

Spec: https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface MDN: https://developer.mozilla.org/en-US/docs/Web/API/UserActivation

This is useful when writing JavaScript that interacts with Web API's that are gated behind user interaction, such as the Web Speech API.

morganney avatar Oct 06 '22 14:10 morganney

Chrome, Edge and Opera are all chromium based so only 1 implementation but 2 are required for a feature to be added.

mathe42 avatar Oct 06 '22 14:10 mathe42

Ok, so the requirements for implementation of a spec sound like it must not be an experimental technology as defined by MDN.

For the record, that seems a little conservative, and makes it harder to adopt TypeScript when leveraging new technologies that have real world implementations (by the world's most popular browser).

morganney avatar Oct 06 '22 17:10 morganney

@morganney You can fork this and change here https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/src/build/bcd.ts#L17 that chrome count as 2 if you need that. And build it for your use.

There are so many experimantal api out there you won't want to include all of them...

mathe42 avatar Oct 06 '22 17:10 mathe42

There are so many experimantal api out there you won't want to include all of them...

@mathe42 I can understand that stance. Like I alluded to, you are making it harder to use TypeScript while leveraging new tech that does have real world implementations when you make that choice, however.

Thanks for the suggested help.

morganney avatar Oct 06 '22 17:10 morganney

Fixed by #1514.

@github-actions close

saschanaz avatar May 18 '23 22:05 saschanaz

Closing because @saschanaz is one of the code-owners of this repository.

github-actions[bot] avatar May 18 '23 22:05 github-actions[bot]