mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-18 05:47:31 -04:00
10 lines
303 B
TypeScript
10 lines
303 B
TypeScript
declare const brand: unique symbol;
|
|
|
|
export type Branded<T, B> = T & { [brand]: B };
|
|
|
|
export type ShortId = Branded<string, "ShortId">;
|
|
|
|
export const asShortId = (value: string): ShortId => value as ShortId;
|
|
|
|
export const isShortId = (value: string): value is ShortId => /^[A-Za-z0-9_-]+$/.test(value);
|