cal.pub0.org/lib/asStringOrNull.tsx

4 lines
96 B
TypeScript

export function asStringOrNull(str: unknown) {
return typeof str === "string" ? str : null;
}