@pdfking/structs
Types
types
BrandType
type BrandType = | "string" | "bool" | "i8" | "i16" | "i32" | "i64" | "i128" | "i256" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256" | "usize" | "f32" | "f64"
Integer
type Integer<TName extends string, T extends BrandType = "i64"> = bigint & BrandInfo<TName, T>
Float
type Float<TName extends string, T extends BrandType = "f64"> = number & BrandInfo<TName, T>
String
type String<TName extends string> = string & BrandInfo<TName, "string">
Struct
type Struct<T, TName extends string> = T & {
__brand_name__?: TName
}Expand
type Expand<T> = T extends infer O
? O extends string | number | bigint | boolean | symbol | null | undefined
? O
: { [K in keyof O]: O[K] }
: neverEnumType
type EnumType<E, T = {}> = [keyof T] extends [never] ? { enum: E } : { enum: E } & TEnumUnion
type EnumUnion<T extends Record<string, Record<string, unknown> | undefined>> = {
[K in keyof T & string]: T[K] extends undefined
? EnumType<K>
: EnumType<K, Exclude<T[K], undefined>>
}[keyof T & string]PartialExcept
type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>
Distance
type Distance = Float<"Distance">
Percentage
type Percentage = Float<"Percentage">
Pixel
type Pixel = Float<"Pixel">
Area
type Area = Float<"Area">
Volume
type Volume = Float<"Volume">
Weight
type Weight = Float<"Weight">
Time
type Time = Float<"Time">
Bytes
type Bytes = Float<"Bytes", "i64">
FileName
type FileName = String<"FileName">
URLString
type URLString = String<"URLString">