ParamOrString
A utility type for use when you need to be able to accept any valid Param
type or a string.
import { ParamOrString } from "@snout/router-path";
function logParam(param: ParamOrString): void {
if (typeof param === "string") {
console.log(param);
} else {
console.log(param.name);
}
}
Functionally equivalent to:
Param<string, any> | string;