type-helpers.ts 851 B

1234567891011121314151617181920
  1. /**
  2. * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. * @author David Sehnal <david.sehnal@gmail.com>
  6. */
  7. export type Mutable<T> = {
  8. -readonly [P in keyof T]: T[P]
  9. }
  10. export type TypedIntArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array
  11. export type TypedFloatArray = Float32Array | Float64Array
  12. export type TypedArray = TypedIntArray | TypedFloatArray
  13. export type NumberArray = TypedArray | number[]
  14. export type UintArray = Uint8Array | Uint16Array | Uint32Array | number[]
  15. export type ValueOf<T> = T[keyof T]
  16. export type ArrayCtor<T> = { new(size: number): { [i: number]: T, length: number } }
  17. /** assignable ArrayLike version */
  18. export type AssignableArrayLike<T> = { [i: number]: T, length: number }