never
assignability check disappears for method call from generic function
#57453
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
π Search Terms
never bivariant method assignable generic
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/dev/bug-workbench/?ts=5.4.0-dev.20240220#code/C4TwDgpgBAYg9nAPAFQHxQLxQN4CgoFQCGAshMABZwAmAFMAFzICUDAbnAJbUA0+hAegFQAzsABORAHYBzCABsQPUZwC2YRVACuUgMZxVqiFOCdZUStCkQAHsCjyz0XUS0iIIixWgAjBXAB3KFtIXWAIamDxcThxCzgocQgiMEgicQBCfgIhYhgdMM44KQZ6JmYMVA5uXABfXFxqCF15dOdisSg4HwArBngkazYIcVRcbp6AOlJyKjoARmYoXIBBcRktIxMugDMLcGgAcilNv3FDqE5PKTh7IhERThkpIh95aGAEsHSiI3C4uB7UCQKDHCDDc64XJNSBSaieYpQfSGYzhSKOaxQ4QTab5PSmYq0RYNfRSToueTyMiUGiYKAoHioWhEfoIFCoZQ+cqVPCEYjTalzWg+Zh1ElESmCmi0CbKRbLYQhZpoqIxcS4IA
π» Code
π Actual behavior
callMethod
does not issue a type warning that "Argument of type 'number' is not assignable to parameter of type 'never'".Doing the same call outside a generic function body causes the error again.
π Expected behavior
I expect a warning, similar to if I had called the method directly or if the method were instead a function.
Additional information about the issue
Note this was originally discovered in the context of
Array<never>
which, when used in a generic function, allows one to unsafelypush
any typeT
: #57419 (comment).The text was updated successfully, but these errors were encountered: