Is it permissible in TypeScript to have the following code snippet?
function getFoo<P = "a"|"b">():string {
// P represents a type, not an actual value!
return "foo";
}
getFoo<"a>">(); // no errors!
If so, what is a practical use case for this and how can the P
type be utilized within the function, whether it assumes the value of "a"
or "b"
?