plugins/bst@asphyxia/utility/type.ts
2021-03-30 18:55:18 +08:00

4 lines
246 B
TypeScript

export type FixedSizeArray<T, TSize extends number> = [T, ...T[]] & { readonly length: TSize }
export function fillArray<T, TSize extends number>(size: TSize, fillValue: T): FixedSizeArray<T, TSize> {
return <any>Array(size).fill(fillValue)
}