Skip to content

ValidBrand

ValidBrand<S> = string extends S ? S : S extends `${infer _A extends LowerChar}${infer _B extends LowerChar}${infer _C extends LowerChar}` ? S : never

Defined in: src/types.ts:43

Validator-style conditional type: resolves to S when S is exactly three lowercase a–z characters, and to never otherwise.

When passed the generic string type it resolves to string, so existing dynamic-brand call sites (e.g. CLI, ORM adapters) are unaffected.

Apply as a parameter intersection on codec constructors:

function createTimestampId<Brand extends string>(brand: Brand & ValidBrand<Brand>, ...)

TypeScript then validates the specific brand literal at each call site without materialising the 17 576-member all-brands union.

S extends string