Skip to content

TS 4.8 Generics completion is now weaker.Β #50680

Closed
@eretica

Description

@eretica

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"

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions