-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Contextual TypesThe issue relates to contextual typesThe issue relates to contextual typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.2.1
Search Terms:
strucutre spread + generic
Code
function id<T>(input: T): T { return input }
function getFoo ({ foo = 42 }) {
return foo
}
const newGetFoo = id(getFoo)
const newGetFoo2 = id(function getFoo ({ foo = 42 }) {
return foo
})
Expected behavior:
newGetFoo and newGetFoo2 should have the same signature
Actual behavior:
newGetFoo
is:
({ foo }: {
foo?: number | undefined;
}) => number
but newGetFoo2
is
({ foo }: any) => number
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Contextual TypesThe issue relates to contextual typesThe issue relates to contextual typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue