resources_manager/types.ts

37 lines
1,000 B
TypeScript
Raw Normal View History

import type { JsonValue } from '@std/json'
2024-05-07 11:32:05 +02:00
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> = T extends JsonValue ? T
: T extends { toJSON(): unknown } ? ReturnType<T['toJSON']>
: T extends { toJSON(): unknown }[]
? { [K: number]: ReturnType<T[typeof K]['toJSON']> }
: never
export type MethodOf<T, K extends keyof T> = {
[P in keyof Pick<T, T[K] extends CallableFunction ? K : never>]: never
}
export type Serializable<T extends object> = {
[key in Exclude<keyof T, 'toJSON' | 'toString' | 'toPrimitive' | 'valueOf'>]:
ToJson<T[key]>
}
export type Posix = {
id: number
home: string
shell: string
}
export type Base64String = `${string}`
export type UrlString = `${
| 'data:'
| 'file://'
| 'http://'
| 'https://'
| 'git:'}${string}`