microsoft / microsoft/TypeScript
Using Parameters in a class member function gets incorrect result while all parameters are optional.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
5.0.2 and 4.9.5
- This is a crash
- This changed between versions ______ and _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
Playground link with relevant code
💻 Code
class T {
// fn(): void;
// fn( name?: string ): void;
fn( name?: string, sex?: number ): void {}
}
class M<X extends T> {
constructor( public m: X ) {}
fn( ...args: Parameters<X['fn' ]> ) {
this.m.fn( ...args );
}
}
function fn2( ...args: Parameters<T[ 'fn' ]> ) {
new T().fn( ...args );
}
🙁 Actual behavior

The fn method in class M has similar code with the global function fn2, but it get errors.
The error message disappears if I add function overload ( uncomment line 3 & 4 in playground ).
🙂 Expected behavior
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.
Research direction
Start by running the linked TypeScript Playground example and compare the class method in M with the global fn2, both with and without the commented overloads. Trace how Parameters<T['fn']> is handled for methods with optional parameters, and consider the issue done when the forwarding method no longer reports an error without requiring overloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100