@thi.ng/api 8.11.33 → 8.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-07-30T22:32:35Z
3
+ - **Last updated**: 2025-08-04T09:13:01Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -11,6 +11,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ ### [8.12.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.12.1) (2025-08-04)
15
+
16
+ #### 🚀 Features
17
+
18
+ - add optional generics for typedarray types (TS5.9 induced) ([2af1b1e](https://github.com/thi-ng/umbrella/commit/2af1b1e))
19
+
14
20
  ### [8.11.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.11.3) (2024-06-21)
15
21
 
16
22
  #### ♻️ Refactoring
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.11.33",
3
+ "version": "8.12.1",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "esbuild": "^0.25.8",
46
- "typedoc": "^0.28.7",
47
- "typescript": "^5.8.3"
46
+ "typedoc": "^0.28.9",
47
+ "typescript": "^5.9.2"
48
48
  },
49
49
  "keywords": [
50
50
  "constants",
@@ -233,5 +233,5 @@
233
233
  "thi.ng": {
234
234
  "tag": "none"
235
235
  },
236
- "gitHead": "1df8a3a9061257ea73ccf1ab9cdf63c81a9f519f\n"
236
+ "gitHead": "0bcedf8d1dd4f30cd06bb2c668599628f2f0141e\n"
237
237
  }
package/typedarray.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { Maybe } from "./null.js";
2
2
  export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;
3
- export type NumericArray = number[] | TypedArray;
4
- export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
5
- export type BigTypedArray = BigInt64Array | BigUint64Array;
6
- export type FloatArray = Float32Array | Float64Array;
7
- export type IntArray = Int8Array | Int16Array | Int32Array;
8
- export type UIntArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
3
+ export type NumericArray<T extends ArrayBufferLike = ArrayBufferLike> = number[] | TypedArray<T>;
4
+ export type TypedArray<T extends ArrayBufferLike = ArrayBufferLike> = FloatArray<T> | FloatArray<T> | IntArray<T> | UIntArray<T>;
5
+ export type BigTypedArray<T extends ArrayBufferLike = ArrayBufferLike> = BigInt64Array<T> | BigUint64Array<T>;
6
+ export type FloatArray<T extends ArrayBufferLike = ArrayBufferLike> = Float32Array<T> | Float64Array<T>;
7
+ export type IntArray<T extends ArrayBufferLike = ArrayBufferLike> = Int8Array<T> | Int16Array<T> | Int32Array<T>;
8
+ export type UIntArray<T extends ArrayBufferLike = ArrayBufferLike> = Uint8Array<T> | Uint8ClampedArray<T> | Uint16Array<T> | Uint32Array<T>;
9
9
  export type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor;
10
10
  export type IntArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
11
11
  export type UIntArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor;
@@ -90,27 +90,27 @@ export declare const INT_ARRAY_CTORS: Record<IntType, IntArrayConstructor>;
90
90
  export declare const UINT_ARRAY_CTORS: Record<UintType, UIntArrayConstructor>;
91
91
  export declare const BIGINT_ARRAY_CTORS: Record<BigType, BigIntArrayConstructor>;
92
92
  export declare const TYPEDARRAY_CTORS: Record<Type, TypedArrayConstructor>;
93
- export interface TypedArrayTypeMap extends Record<Type | GLType, TypedArray> {
94
- u8: Uint8Array;
95
- u8c: Uint8ClampedArray;
96
- i8: Int8Array;
97
- u16: Uint16Array;
98
- i16: Int16Array;
99
- u32: Uint32Array;
100
- i32: Int32Array;
101
- f32: Float32Array;
102
- f64: Float64Array;
103
- [GLType.U8]: Uint8Array;
104
- [GLType.I8]: Int8Array;
105
- [GLType.U16]: Uint16Array;
106
- [GLType.I16]: Int16Array;
107
- [GLType.U32]: Uint32Array;
108
- [GLType.I32]: Int32Array;
109
- [GLType.F32]: Float32Array;
93
+ export interface TypedArrayTypeMap<T extends ArrayBufferLike = ArrayBufferLike> extends Record<Type | GLType, TypedArray<T>> {
94
+ u8: Uint8Array<T>;
95
+ u8c: Uint8ClampedArray<T>;
96
+ i8: Int8Array<T>;
97
+ u16: Uint16Array<T>;
98
+ i16: Int16Array<T>;
99
+ u32: Uint32Array<T>;
100
+ i32: Int32Array<T>;
101
+ f32: Float32Array<T>;
102
+ f64: Float64Array<T>;
103
+ [GLType.U8]: Uint8Array<T>;
104
+ [GLType.I8]: Int8Array<T>;
105
+ [GLType.U16]: Uint16Array<T>;
106
+ [GLType.I16]: Int16Array<T>;
107
+ [GLType.U32]: Uint32Array<T>;
108
+ [GLType.I32]: Int32Array<T>;
109
+ [GLType.F32]: Float32Array<T>;
110
110
  }
111
- export interface BigTypedArrayTypeMap extends Record<BigType, BigTypedArray> {
112
- i64: BigInt64Array;
113
- u64: BigUint64Array;
111
+ export interface BigTypedArrayTypeMap<T extends ArrayBufferLike = ArrayBufferLike> extends Record<BigType, BigTypedArray<T>> {
112
+ i64: BigInt64Array<T>;
113
+ u64: BigUint64Array<T>;
114
114
  }
115
115
  /**
116
116
  * Returns canonical {@link Type} value of `type` by first
@@ -172,11 +172,11 @@ export declare const sizeOf: (type: Type | BigType | GLType) => number;
172
172
  * @param type - array type enum
173
173
  */
174
174
  export declare function typedArray<T extends Type | GLType>(type: T, length: number): TypedArrayTypeMap[T];
175
- export declare function typedArray<T extends Type | GLType>(type: T, src: ArrayLike<number> | ArrayBufferLike): TypedArrayTypeMap[T];
176
- export declare function typedArray<T extends Type | GLType>(type: T, buf: ArrayBufferLike, byteOffset: number, length?: number): TypedArrayTypeMap[T];
177
- export declare function typedArray<T extends BigType>(type: T, length: number): BigTypedArrayTypeMap[T];
178
- export declare function typedArray<T extends BigType>(type: T, src: ArrayLike<bigint> | ArrayBufferLike): BigTypedArrayTypeMap[T];
179
- export declare function typedArray<T extends BigType>(type: T, buf: ArrayBufferLike, byteOffset: number, length?: number): BigTypedArrayTypeMap[T];
175
+ export declare function typedArray<T extends Type | GLType, B extends ArrayBufferLike>(type: T, src: ArrayLike<number> | B): TypedArrayTypeMap<B>[T];
176
+ export declare function typedArray<T extends Type | GLType, B extends ArrayBufferLike>(type: T, buf: B, byteOffset: number, length?: number): TypedArrayTypeMap<B>[T];
177
+ export declare function typedArray<T extends BigType, B extends ArrayBufferLike>(type: T, length: number): BigTypedArrayTypeMap<B>[T];
178
+ export declare function typedArray<T extends BigType, B extends ArrayBufferLike>(type: T, src: ArrayLike<bigint> | B): BigTypedArrayTypeMap<B>[T];
179
+ export declare function typedArray<T extends BigType, B extends ArrayBufferLike>(type: T, buf: ArrayBufferLike, byteOffset: number, length?: number): BigTypedArrayTypeMap<B>[T];
180
180
  /**
181
181
  * Constructs a typed array for given `type` and populates it with given vector
182
182
  * values.