typescript.ts 455 B

123456789101112131415
  1. export const mutable = <T extends readonly any[] | Record<string, unknown>>(
  2. val: T
  3. ) => val as Mutable<typeof val>
  4. export type Mutable<T> = { -readonly [P in keyof T]: T[P] }
  5. export type HTMLElementCustomized<T> = HTMLElement & T
  6. /**
  7. * @deprecated stop to use null
  8. * @see {@link https://github.com/sindresorhus/meta/discussions/7}
  9. */
  10. export type Nullable<T> = T | null
  11. export type Arrayable<T> = T | T[]
  12. export type Awaitable<T> = Promise<T> | T