Closed
Description
I found alternative solution on stack overflow but was advised to open an issue here
TypeScript Version: 3.8.3
Search Terms:
ReturnType
Parameters
Function
any
never
Code
const abc = (a:never):number=>1
type a = ReturnType< typeof abc> //any
const abc2 = (a:number, b:never):number=>1
type a2 = ReturnType< typeof abc2> //any
Expected behavior:
type a
and a2
should be number
regardless of the types of parameters
Actual behavior:
type a
and a2
are any
if any of the types of the parameters are never
Playground
link
the original question is posted on here with details describing the use case
link