From 3d5cd6110a1678fd138efa0285a00c8f1781089e Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Thu, 28 Mar 2019 18:10:24 +0000 Subject: [PATCH] feat(vectors): add Vec2/3/4Like type aliases, update ReadonlyVec --- packages/vectors/src/api.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/vectors/src/api.ts b/packages/vectors/src/api.ts index a26449ff2d..bfb7f622dc 100644 --- a/packages/vectors/src/api.ts +++ b/packages/vectors/src/api.ts @@ -1,4 +1,5 @@ import { + ArrayLikeIterable, Fn, Fn2, Fn3, @@ -7,16 +8,20 @@ import { ICopy, IEmpty, IEqualsDelta, - ILength + ILength, + Tuple, + TypedArray } from "@thi.ng/api"; export interface Vec extends Iterable, ILength { [id: number]: number; } -export interface ReadonlyVec extends Iterable, ILength { - readonly [id: number]: number; -} +export type ReadonlyVec = ArrayLikeIterable; + +export type Vec2Like = Tuple | TypedArray; +export type Vec3Like = Tuple | TypedArray; +export type Vec4Like = Tuple | TypedArray; export interface StridedVec { buf: Vec;