You can do this trick for type-checking emptiness of string literals
https://www.typescriptlang.org/play/?jsx=0#code/C4TwDgpgBAsg...
declare const brand: unique symbol;
type NonEmptyString = string & { readonly [brand]: 'NonEmptyString' };
// the ONLY non-cast way to produce one
export function nonEmptyString(s: string): NonEmptyString | undefined {
return s.length > 0 ? (s as NonEmptyString) : undefined;
}
export type { NonEmptyString };