Bug Report
Scenario 1: Code completion stopped working by adding an undefined as the default value for the generic type. TypeScript narrows down the range of expected argument types, and as a result, the code completion doesn't work correctly. It works fine in Typescript 5.0 or below.
Scenario 2: Code completion stopped when using an overloaded function type that combines union types with named tuples containing a generic type parameter. it works fine in Typescript 5.0 or below.
🔎 Search Terms
Code completion issues in typescript 5.1
🕗 Version & Regression Information
The Issue started occurring on typescript 5.1 and beyond. It works fine in versions 5.0 or below.
⏯ Playground Link
Scenario 1:https://tsplay.dev/w1xZGW
Scenario 2:https://tsplay.dev/WKvGZm
💻 Code
Scenario 1:
declarefunctionfunc<constTextends'a'|'b'|undefined=undefined,>(arg?: T): string;// Code completion does not workfunc('')Scenario 2:
interfaceFunc{<Keyextends'a'|'b'>(
...args:
|[key: Key,options?: any]|[key: Key,defaultValue: string,options?: any]): string;}declareconstfunc: Func;// Code completion does not workfunc('');🙁 Actual behavior
Code completion doesn't work
🙂 Expected behavior
Code completion should work as in the images below:


Bug Report
Scenario 1: Code completion stopped working by adding an
undefinedas the default value for the generic type. TypeScript narrows down the range of expected argument types, and as a result, the code completion doesn't work correctly. It works fine in Typescript 5.0 or below.Scenario 2: Code completion stopped when using an overloaded function type that combines union types with named tuples containing a generic type parameter. it works fine in Typescript 5.0 or below.
🔎 Search Terms
Code completion issues in typescript 5.1
🕗 Version & Regression Information
The Issue started occurring on typescript 5.1 and beyond. It works fine in versions 5.0 or below.
⏯ Playground Link
Scenario 1:https://tsplay.dev/w1xZGW
Scenario 2:https://tsplay.dev/WKvGZm
💻 Code
Scenario 1:
Scenario 2:
🙁 Actual behavior
Code completion doesn't work
🙂 Expected behavior
Code completion should work as in the images below: