Typescript: HTMLVideoElement is missing 'playsinline' attribute

Created on 15 Jan 2020  Β·  4Comments  Β·  Source: microsoft/TypeScript


TypeScript Version: 3.8.0


Search Terms:
HTMLVideo, HTMLVideoElement, playsinline
Code

const el = document.createElement('video');
el.playsinline = true; // Property 'playsinline' does not exist on type 'HTMLVideoElement'.

Expected behavior:

There should not be a TS error. playsinline is a boolean attribute that exists on the <video> element per https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement

Actual behavior:

There is a TS error: Property 'playsinline' does not exist on type 'HTMLVideoElement'.

Playground Link:
https://www.typescriptlang.org/play/?ssl=2&ssc=92&pln=1&pc=1#code/MYewdgzgLgBApgGxgXhgExMArgWzmKAOmACc4BDKOAUQTjwIAoByANwEs04RmBKAbgCwAKESEADgnIBPCOzAJ5cFDCgkscfjAD02mAAUSIcXBJRpMZpJlyFS5uhBwIMMCFhwAHu2gxwq6RNLAAkAFQBZABkANU5uWnp8KGZCIA

Related Issues:
None.

Bug lib.d.ts

Most helpful comment

While the attribute is called playsinline, it is exposed as playsInline (capitalized "i") in the DOM.

https://html.spec.whatwg.org/multipage/media.html#the-video-element

All 4 comments

While the attribute is called playsinline, it is exposed as playsInline (capitalized "i") in the DOM.

https://html.spec.whatwg.org/multipage/media.html#the-video-element

I had the same problem too~,playsInline is ok!

yeah, remember that typescript uses cammelCase
like: autoplay should be autoPlay
and playsinline should be playsInline

Any progress?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bgrieder picture bgrieder  Β·  3Comments

dlaberge picture dlaberge  Β·  3Comments

Antony-Jones picture Antony-Jones  Β·  3Comments

Zlatkovsky picture Zlatkovsky  Β·  3Comments

manekinekko picture manekinekko  Β·  3Comments