-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Description
π Search Terms
assignability any never signature
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
// source assignable to the target
const target1: (...args: any) => any = (...args: never) => 'foo'
// same source, but target now has *identical* return type as the source and all of a sudden it fails
const target2: (...args: any) => 'foo' = (...args: never) => 'foo'
// similar issue, target has the same return as in `target1` (any) but this time both source and target have **identical** extra leading parameter and it fails
const target3: (arg: unknown, ...args: any) => any = (arg: unknown, ...args: never) => 'foo'
// similar issue, target has the same return as in `target1` (any) but this time both source and target have **identical** `this` parameter and it fails
const target4: (this: unknown, ...args: any) => any = function (this: unknown, ...args: never) { return "foo"; };π Actual behavior
Assignability rules behave weirdly/inconsistently in those simple examples
π Expected behavior
I'd expect more consistent results
Additional information about the issue
relates to #55667 - the fact examples 2-4 error is the reason why that issue exists
LukeAbby and mkantor
Metadata
Metadata
Assignees
Labels
No labels