-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TS 4.8 Generics completion is now weaker.ย #50680
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
๐ Search Terms
Generics completion is now weaker.
๐ Version & Regression Information
This changed between versions 4.7.4 and 4.8.2
โฏ Playground Link
๐ป Code
export const func = <T extends string>({ keys }: { keys: T[] }) => {
const firstKey = keys[0];
return {
keys,
firstKey
} as const;
};
// 4.8.2 firstKey string
// 4.7.4 firstKey "aa" | "bb"
const { keys, firstKey } = func({keys: ["aa", "bb"]})๐ Actual behavior
4.8.2 firstKey type of string
๐ Expected behavior
firstKey type of "aa" | "bb"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue