Skip to content

Inconsistency when assigning a never type parameter to any[] type parameterΒ #56379

@sw6ueyz

Description

@sw6ueyz

πŸ”Ž Search Terms

inconsistency any never parameter

πŸ•— Version & Regression Information

  • This changed between versions 4.9.5 and 5.0.4

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.0.4#code/FDAuE8AcFMAIBUCMsC8sAUHYA9YC5YA7aAN2gCdYBKVAPlhIHsBLAE1g+tmm1GkNYBnLJgB04nPlgBDQuADaAXS4p6TNpy4B+WKHIBXOAQBm0gDaDoAbhAQYCAEyoRkgsTKUaq2PsIBrQkYAd0IuHj4BYUwxCVwCWQVlL3pfAODQmh09QylTC2sQAHpChGRmYTzLABpHWHLdA2hgIA

πŸ’» Code

type T1 = ( ( x : never ) => void    ) extends ( ( ... x : any[] ) => void    ) ? true : false;

type T2 = ( ( x : never ) => unknown ) extends ( ( ... x : any[] ) => unknown ) ? true : false;

// T1 is false, T2 is true

πŸ™ Actual behavior

5.0.4 and after : T1 is false, T2 is true.
4.9.5 and before : T1 is false, T2 is false.

πŸ™‚ Expected behavior

At least T1 and T2 should be the same value.
And if any is not assignable to never, both should be false.

Additional information about the issue

5.0.4 link:

https://www.typescriptlang.org/play?ts=5.0.4#code/FDAuE8AcFMAIBUCMsC8sAUHYA9YC5YA7aAN2gCdYBKVAPlhIHsBLAE1g+tmm1GkNYBnLJgB04nPlgBDQuADaAXS4p6TNpy4B+WKHIBXOAQBm0gDaDoAbhAQYCAEyoRkgsTKUaq2PsIBrQkYAd0IuHj4BYUwxCVwCWQVlL3pfAODQmh09QylTC2sQAHpChGRmYTzLABpHWHLdA2hgIA

4.9.5 link:

https://www.typescriptlang.org/play?ts=4.9.5#code/FDAuE8AcFMAIBUCMsC8sAUHYA9YC5YA7aAN2gCdYBKVAPlhIHsBLAE1g+tmm1GkNYBnLJgB04nPlgBDQuADaAXS4p6TNpy4B+WKHIBXOAQBm0gDaDoAbhAQYCAEyoRkgsTKUaq2PsIBrQkYAd0IuHj4BYUwxCVwCWQVlL3pfAODQmh09QylTC2sQAHpChGRmYTzLABpHWHLYSuhgIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions