-
Notifications
You must be signed in to change notification settings - Fork 13.3k
No variadic tuple inference from trailing optional to non-optional #39607
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 4.0.0-dev
Code
declare function getUser(id: string, options?: { x?: string }): string;
declare function getOrgUser(id: string, orgId: number, options?: { y?: number, z?: boolean }): void;
function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U) {
return (...args: [...T]) => method(...args, {});
}
callApi(getUser); // Error, but shouldn't be
callApi(getOrgUser); // Error, but shouldn't beExpected behavior:
No errors.
Actual behavior:
Errors.
Playground Link:
Related Issues:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue