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

lib.dom.d.ts window interfaces missing "gamepadconnected" and "gamepaddisconnected" #39425

Closed
jsejcksn opened this issue Jul 5, 2020 · 0 comments · Fixed by microsoft/TypeScript-DOM-lib-generator#925
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19
Milestone

Comments

@jsejcksn
Copy link

jsejcksn commented Jul 5, 2020

TypeScript Version: 4.0.0-dev.20200703

Search Terms: gamepad OR gamepadconnected

Code

1:

window.addEventListener('gamepadconnected', event => console.log(event.gamepad));

Property 'gamepad' does not exist on type 'Event'.

2:

window.addEventListener('gamepadconnected', (event: GamepadEvent) => console.log(event.gamepad));

No overload matches this call. Overload 1 of 2, '(type: "abort" | "afterprint" | "beforeprint" | "beforeunload" | "blur" | "canplay" | "canplaythrough" | "change" | "click" | "compassneedscalibration" | "contextmenu" | "dblclick" | ... 122 more ... | "unhandledrejection", listener: (this: Window, ev: Event | ... 22 more ... | PromiseRejectionEvent) => any, options?: boolean | ... 1 more ... | undefined): void', gave the following error. Argument of type '"gamepadconnected"' is not assignable to parameter of type '"abort" | "afterprint" | "beforeprint" | "beforeunload" | "blur" | "canplay" | "canplaythrough" | "change" | "click" | "compassneedscalibration" | "contextmenu" | "dblclick" | ... 122 more ... | "unhandledrejection"'. Overload 2 of 2, '(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void', gave the following error. Argument of type '(event: GamepadEvent) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject'. Type '(event: GamepadEvent) => void' is not assignable to type 'EventListener'. Types of parameters 'event' and 'evt' are incompatible. Property 'gamepad' is missing in type 'Event' but required in type 'GamepadEvent'.

Expected behavior:

No errors.

Actual behavior:

See errors ☝️

Playground Link: https://www.typescriptlang.org/play?target=99&ts=4.0.0-dev.20200703#code/O4SwdgJg9sB0CGEIFEBuBTMAXAMiAzlpugE4AUA5AObwC26ADogMZRhjrNEQUA0ABOgzZ+AXgB8-VmHxQANulhyoVMkMxZYNekwgBKPQG4AUKEgwESNBryFi5anUYs2HLuh4C1wrAC5+AOJOutbYemKS0rIKSireGlrBiAYmQA

lib.dom.d.ts has Gamepad, GamepadEvent, etc., but the related window interfaces lack references to the Gamepad API

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Jul 14, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jul 14, 2020
@sandersn sandersn added the PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19 label Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants