Microsoft/TypeScript

Inconsistencies in assignability rules around top-level-like signatures

Open

#62712 opened on Nov 3, 2025

View on GitHub
 (2 comments) (3 reactions) (0 assignees)TypeScript (48,455 stars) (6,726 forks)batch import
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

https://www.typescriptlang.org/play/?ts=6.0.0-dev.20251030#code/PTAEGcHsFcCcGMCmoCG5wEsDmA7FAjAG2QBdJQSALUlWLREgKHkh3BItvpIEYAuUAAoAdKK7gBKHAE8AlKAC8APlQzFQ0cPECciAG6JY85aADkAM0iRTjRiAgoAtsihwkAGlD5oHElwagOJAA7qCUaKAAVBgAJog4JBjwKISRoLAMcDgU0gAOyBFULjAIBTgxqISEoJDmqBDQMXHZGBzmKBiE4Mys7Jx0DABMAiJidBKqcooqFlam6qNa4zr6hsYzlta29piOnbSgGOjQiJ5+Axzh4BTUDs7pmbDZERjZAAbn3DxvQlJT3r5KEcKBh7vhIFQICUkKoKp8AuEDFFos1EslUmlEAAPEiwFCgYgoGKvLCgXK0JwMQyww5tDpdRA9Ni+fwkADMIy4AmgOAA1kFgjhPJptJN1pMFlzQDz+SEhaARctAqsjNMzJsbHYwLt9rBDsdTv1uGFCrdwJSHiQsqhrq9QB9Wd9fjJ5ACbsDEmCIZQoW4ynDWSakZEUfE0SkQ-aqEcfuS8c4SNSpBVWqB2p1wIyWMyjQwACwjaMTGUC+WKrATP7iv7qcw8+CJVhCIvcvml4VjCsrAyqgDelutACJNoOANygAC+o8YQA

💻 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

Contributor guide