diff --git a/types.ts b/types.ts new file mode 100644 index 0000000..ec9ddd5 --- /dev/null +++ b/types.ts @@ -0,0 +1,28 @@ +import { JsonValue } from '@std/json' + +export type UUID = `${string}-${string}-${string}-${string}-${string}` +export type DateString = + `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z"` +export type Login = `${string}.${string}` +export type MailAddress = `${string}@${string}.${string}` + +export type ToJson = T extends JsonValue ? T + : T extends { toJSON(): unknown } ? ReturnType + : T extends { toJSON(): unknown }[] + ? { [K: number]: ReturnType } + : never + +export type MethodOf = { + [P in keyof Pick]: never +} + +export type Serializable = { + [key in Exclude]: + ToJson +} + +export type Posix = { + id: number + home: string + shell: string +}