I would like to specify that 'To' is not allowed to be inferred as '{}'.
Perhaps some compilation flag, --noInferObjectFromGeneric, or something else.
function convert<To, From>(from: From): To {
return from as any as To; // doesn't really matter
}
var x = convert(1); // To = {}
I would like to specify that 'To' is not allowed to be inferred as '{}'.
Perhaps some compilation flag, --noInferObjectFromGeneric, or something else.