You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceHasMethod{method(first?: string,second?: number): void;}functionfn<HasMethodLikeextendsHasMethod>(instance: HasMethodLike,
...args: Parameters<HasMethodLike['method']>){instance.method(...args);// ~~~~~~~// Argument of type 'string | number | undefined' is not assignable to parameter of type 'string | undefined'.// Type 'number' is not assignable to type 'string'.}
Based on this code, I thought that I would be able to also notice some issues around unions of tuples being spread even outside of generic contexts. However, so far, I can't find a case that would prove that. Even though those arguments are not synthesized in this case it still works OK thanks to other branches of the code in getSignatureApplicabilityError
LvChengbin
changed the title
Using Parameters in a class member function gets incorrect result while all parameters all optional.
Using Parameters in a class member function gets incorrect result while all parameters are optional.
Mar 29, 2023
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
5.0.2 and 4.9.5
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.0.2&ssl=15&ssc=1&pln=16&pc=1#code/FAYwNghgzlAEAqsDexZtgeg7AZgOwAoBKALlgDcB7ASwBMBuVdLXQ2PCAWwFMB+MqABcATtTwBzWKQo0GTNPgLsufASLHiANLCjcAHv3YBXTgCNuwqWSp1kAX2APgoSDFgBZADwANWPsHceLRw8AB8yPKwIJR4QsJGIIKUwkoADkamYNQgsJxkvkT2zuisSgB0FRDC4lBkAApVKgHCUD4A2gDk+B2wALrhhSglJYIAFtRQZZxlirAVZVU1UowlDk44RniJ1DGsAEzlldW1sA3CTRat8G2wXXg9-VIRJXjcAO4IxDNs84twRIw7EA
Playground link with relevant code
💻 Code
🙁 Actual behavior
The
fn
method in classM
has similar code with the global functionfn2
, but it get errors.The error message disappears if I add function overload ( uncomment line 3 & 4 in playground ).
🙂 Expected behavior
The text was updated successfully, but these errors were encountered: