Skip to content
Snippets Groups Projects
Commit 921d23e7 authored by Alexander Rose's avatar Alexander Rose
Browse files

add NonNullableArray type helper

parent 709944c8
No related branches found
No related tags found
No related merge requests found
/** /**
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
* *
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author David Sehnal <david.sehnal@gmail.com> * @author David Sehnal <david.sehnal@gmail.com>
...@@ -17,4 +17,6 @@ export type UintArray = Uint8Array | Uint16Array | Uint32Array | number[] ...@@ -17,4 +17,6 @@ export type UintArray = Uint8Array | Uint16Array | Uint32Array | number[]
export type ValueOf<T> = T[keyof T] export type ValueOf<T> = T[keyof T]
export type ArrayCtor<T> = { new(size: number): { [i: number]: T, length: number } } export type ArrayCtor<T> = { new(size: number): { [i: number]: T, length: number } }
/** assignable ArrayLike version */ /** assignable ArrayLike version */
export type AssignableArrayLike<T> = { [i: number]: T, length: number } export type AssignableArrayLike<T> = { [i: number]: T, length: number }
\ No newline at end of file
export type NonNullableArray<T extends any[] | ReadonlyArray<any>> = T extends any[] ? NonNullable<T[0]>[] : ReadonlyArray<NonNullable<T[0]>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment