[microsoft/TypeScript] Inconsistencies in assignability rules around top-level-like signatures (Issue #62712)
DRANK

Andarist created an issue (microsoft/TypeScript#62712) ### 🔎 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 ```ts // 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 -- Reply to this email directly or view it on GitHub: https://github.com/microsoft/TypeScript/issues/62712 You are receiving this because you are subscribed to this thread. Message ID: <microsoft/TypeScript/issues/62712@github.com>

github.com
Related Topics: TypeScript
1 comments