Skip to content

Arrow function generics are resolved #33117

@remcohaszing

Description

@remcohaszing

TypeScript Version: 3.5.3

Search Terms: arrow function generic

Code

export const foo = <T extends keyof HTMLElementEventMap>(t: T): T => t;
export function bar<T extends keyof HTMLElementEventMap>(t: T): T {
  return t;
}

Expected behavior:

The d.ts file contains unresolved types for a list of strings for arrow function generics.

export declare const foo: <T extends keyof HTMLElementEventMap>(t: T) => T;
export declare function bar<T extends keyof HTMLElementEventMap>(t: T): T;

Actual behavior:

The d.ts file contains resolved types for a list of strings for arrow function generics.

export declare const foo: <T extends "waiting" | "error" | "abort" | "cancel" | "progress" | "ended" | "change" | "input" | "select" | "fullscreenchange" | "fullscreenerror" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "canplay" | "canplaythrough" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "focus" | "gotpointercapture" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadend" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "wheel" | "copy" | "cut" | "paste">(t: T) => T;
export declare function bar<T extends keyof HTMLElementEventMap>(t: T): T;

Playground Link: N/A — The issue exists in the d.ts file output.

Related Issues:

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions