microsoft / microsoft/TypeScript
Missing controlsList property in HTMLMediaElement
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
controlsList HTMLMediaElement
Code
const video = $htmlVideoElement as HTMLVideoElement
video.controlsList.value = "nodownload";
Expected behavior:
Works so we can do things as shown https://googlechrome.github.io/samples/media/controlslist.html and as documented by https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/controlsList
Actual behavior:
controlsList is not valid for HTMLVideoElement
Related Issues:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19500
Workaround is to add and let the declarations get merged.
declare global {
interface HTMLMediaElement {
readonly controlsList: DOMTokenList
}
}
Or add an ambient type file
interface HTMLMediaElement {
readonly controlsList: DOMTokenList;
}
interface DOMTokenList {
/**
* Returns the associated set as string.
* Can be set, to change the associated attribute.
*/
value: string;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the HTMLMediaElement and DOMTokenList declarations used by the HTMLVideoElement example. Compare the documented controlsList API and its value property with the current declarations, then verify that the provided Playground code type-checks without the ambient workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100