microsoft / microsoft/TypeScript
Missing controlsList property in HTMLMediaElement
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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;
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die Deklarationen von HTMLMediaElement und DOMTokenList zu finden, die vom HTMLVideoElement-Beispiel verwendet werden. Vergleiche die dokumentierte controlsList-API und ihre value-Eigenschaft mit den aktuellen Deklarationen und überprüfe anschließend, dass der bereitgestellte Playground-Code ohne den ambient workaround typgeprüft wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100