We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: 3.1.0-dev.20180823
Search Terms: object literal method argument
Code
function goofus <ARGS extends any[]> (f: (...args: ARGS) => any ) {} goofus((a: string) => ({ dog() { return a; } })); goofus((a: string) => ({ dog: function() { return a; } }));
Expected behavior: infers ARGS === [string]
ARGS === [string]
Actual behavior: [ts] Argument of type '(a: string) => { dog(): string; }' is not assignable to parameter of type '() => any'.
[ts] Argument of type '(a: string) => { dog(): string; }' is not assignable to parameter of type '() => any'.
Note that everything works correctly if you do any of the below:
function gallant <ARG extends any> (f: (arg: ARG) => any ) {}
goofus((a: string) => ({ dog: () => a }));
goofus(function (a: string) { return { dog() { return a; } } });
Playground Link: link
Related Issues: couldn't find any
The text was updated successfully, but these errors were encountered:
@ahejlsberg regression from 3.0 -> 3.1; I'm assuming your recent args work addresses this
Sorry, something went wrong.
This is an issue caused by #25937. I'll have a fix up shortly.
Thank you!
ahejlsberg
No branches or pull requests
TypeScript Version: 3.1.0-dev.20180823
Search Terms: object literal method argument
Code
Expected behavior:
infers
ARGS === [string]
Actual behavior:
[ts] Argument of type '(a: string) => { dog(): string; }' is not assignable to parameter of type '() => any'.
Note that everything works correctly if you do any of the below:
function gallant <ARG extends any> (f: (arg: ARG) => any ) {}
goofus((a: string) => ({ dog: () => a }));
goofus(function (a: string) { return { dog() { return a; } } });
Playground Link: link
Related Issues: couldn't find any
The text was updated successfully, but these errors were encountered: