When working with Typescript, imagine I need to call a function that has the following signature-
function foo(param: "TRUE"|"FALSE"|"NONE")
Is there a way to achieve something like this-
var str = runtimeString()
if(str === "TRUE" | str === "FALSE" | str === "NONE")
foo(str)
Alternatively, is using explicit values the only approach-
var str = runtimeString()
if(str === "TRUE")
foo("TRUE")
else if(str === "FALSE" )
foo("FALSE")
else if(str === "NONE")
foo("NONE")