Closed
Description
Bug Report
π Search Terms
- Argument type infer not work correctly
π Version & Regression Information
seems to be every version of typescript shows this behavior
β― Playground Link
In this example, if you try the use commits in actions.a, you will see the type of commits is:
Record<string, (state: {
name: string;
arr: never[];
}, ...args: any) => void>If I update the commit function to use state: State,
...
{
commits: {
a: (state: State, newName: string) => 'a'
}
}
...then the commits type in actions.a will be exactly what commits is, eg:
{
a: (state: State, newName: string) => string;
}π Actual behavior
Without specify state: State, the commits type infer in actions.a not correct. I suppose TS will infer what state is, and there should not be different with/without specify state: State.
π Expected behavior
there should not be different with/without specify state: State.

