Microsoft/TypeScript
View on GitHubInconsistencies in assignability rules around top-level-like signatures
Open
#62712 opened on Nov 3, 2025
Cursed?Domain: check: Variance RelationshipsHelp WantedPossible Improvement
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 https://github.com/microsoft/TypeScript/issues/55667 - the fact examples 2-4 error is the reason why that issue exists