microsoft / microsoft/TypeScript
Instantiation expressions should filter overloads by type parameter constraints
Open
@ahejlsberg is already working on this.
Since Feb 13, 2026.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
🔎 Search Terms
call signature constructor signature type parameter
🕗 Version & Regression Information
Tested in v4.7.4, v5.9.3 and Nightly (v6.0.0-dev.20260204)
Syntax error before v4.7.4
⏯ Playground Link
💻 Code
declare const f: {
<T>(x: T): T;
new<T extends object>(x: T): T;
};
const a = f<{ b: 1 }>;
// ^? const a: { (x: { b: 1; }): { b: 1; }; new (x: { b: 1; }): { b: 1; }; }
const b = f<1>;
// ^? const b: { (x: 1): 1; new <T extends object>(x: T): T; }
// Type 'number' does not satisfy the constraint 'object'
🙁 Actual behavior
The type argument I pass to the object must met the requirements of both signatures
🙂 Expected behavior
The incompatible signature should just be filtered out, leaving only the compatible one
const b = f<1>;
// ^? const b: (x: number) => number
Additional information about the issue
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.