Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some interfaces and properties declared in lib.dom are not being used by TS 3.9.2 #38544

Closed
Serabe opened this issue May 13, 2020 · 6 comments
Closed
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Question An issue which isn't directly actionable in code
Milestone

Comments

@Serabe
Copy link

Serabe commented May 13, 2020

TypeScript Version: 3.9.2

Search Terms: "types not found 3.9", "TS2304", "TS4060"

Code

function getTracks(media: HTMLMediaElement): AudioTrackList {
    return media.audioTracks;
}

Expected behavior: AudioTrackList and property audioTracks are recognised as they were in 3.8.3

Actual behavior: Several errors of type TS2304 and TS4060 are being raised.

Playground Link:

Related Issues: No

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels May 13, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone May 13, 2020
@RyanCavanaugh RyanCavanaugh added the Help Wanted You can do this label May 13, 2020
@ShuiRuTian
Copy link
Contributor

@Serabe
Copy link
Author

Serabe commented May 14, 2020

HTMLMediaElement.audioTracks Supported in Firefox >=33 (behind feature flag), Opera and Safari.
AudioTrackList Supported on Chrome >= 45(behind feature flag), Edge >=12, Firefox >=33 (behind feature flag), Internet Explorer >= 10, Safari.

How can it be argued that it is not standard when it is in the HTML Living spec as of today (last update was on May, 13th)?

@ShuiRuTian
Copy link
Contributor

Make sense to me. So what we could do is just leave it to typescript team, for we do not exactly know the final decision?
Would it be better to remove "help wanted" label?

@orta
Copy link
Contributor

orta commented May 20, 2020

Hi folks, we document the heuristics which we use to determine if something is production ready for being added to our dom APIs.

Being only available on just IE and Safari isn't stable enough for inclusion yet (maybe that'll change by the time 4.0 rolls around and it can be added back

You can add an ambient *.d.ts to your project with:

interface AudioTrackList {
     [Symbol.iterator](): IterableIterator<AudioTrack>;
 }

interface HTMLVideoElement {
  readonly audioTracks: AudioTrackList

  msFrameStep(forward: boolean): void;
  msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;
  msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;
  webkitEnterFullScreen(): void;
  webkitEnterFullscreen(): void;
  webkitExitFullScreen(): void;
  webkitExitFullscreen(): void;

  msHorizontalMirror: boolean;
  readonly msIsLayoutOptimalForPlayback: boolean;
  readonly msIsStereo3D: boolean;
  msStereo3DPackingMode: string;
  msStereo3DRenderMode: string;
  msZoom: boolean;
  onMSVideoFormatChanged: ((this: HTMLVideoElement, ev: Event) => any) | null;
  onMSVideoFrameStepCompleted: ((this: HTMLVideoElement, ev: Event) => any) | null;
  onMSVideoOptimalLayoutChanged: ((this: HTMLVideoElement, ev: Event) => any) | null;
  webkitDisplayingFullscreen: boolean;
  webkitSupportsFullscreen: boolean;
}

interface MediaError {
  readonly msExtendedCode: number;
  readonly MS_MEDIA_ERR_ENCRYPTED: number;
}

To bring them back until it's is further down the standard process 👍

@orta orta added Question An issue which isn't directly actionable in code and removed Bug A bug in TypeScript Help Wanted You can do this labels May 20, 2020
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.

@robwalch
Copy link

robwalch commented Feb 9, 2021

You can add an ambient *.d.ts to your project with:

Tried this with typescript @4.1.4 but then I get error TS2304: Cannot find name 'AudioTrack'.. So what happened to the definition of AudioTrack?

Not only that, but TS2339: Property 'length' does not exist on type 'AudioTrackList'. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

6 participants