File tree 2 files changed +16
-17
lines changed
2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change 1
- type TypedArray =
2
- | Int8Array
3
- | Uint8Array
4
- | Uint8ClampedArray
5
- | Int16Array
6
- | Uint16Array
7
- | Int32Array
8
- | Uint32Array
9
- | Float32Array
10
- | Float64Array
11
- | BigInt64Array
12
- | BigUint64Array ;
1
+ import TypedArrayNames from 'possible-typed-array-names' ;
13
2
14
- declare function typedArrayByteOffset ( value : TypedArray ) : number ;
3
+ declare namespace typedArrayByteOffset {
4
+ export type TypedArrayName = typeof TypedArrayNames [ number ] ;
5
+
6
+ export type TypedArrayConstructor = typeof globalThis [ TypedArrayName ] ;
7
+
8
+ export type TypedArray = TypedArrayConstructor [ 'prototype' ] ;
9
+ }
10
+
11
+ declare function typedArrayByteOffset ( value : typedArrayByteOffset . TypedArray ) : number ;
15
12
declare function typedArrayByteOffset ( value : unknown ) : false ;
16
13
17
14
export = typedArrayByteOffset ;
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ var gPO = require('reflect.getprototypeof/polyfill')();
6
6
7
7
var typedArrays = require ( 'available-typed-arrays' ) ( ) ;
8
8
9
- /** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array } TypedArray */
10
- /** @typedef {(x: TypedArray) => number } ByteOffsetGetter */
9
+ /** @typedef {(x: import('.').TypedArray) => number } ByteOffsetGetter */
11
10
12
- /** @type {Object.<typeof typedArrays, ByteOffsetGetter> } */
13
- var getters = { } ;
11
+ /** @type {Record<import('.').TypedArrayName, ByteOffsetGetter> } */
12
+ var getters = {
13
+ // @ts -expect-error TS can't handle __proto__ or `satisfies` in jsdoc
14
+ __proto__ : null
15
+ } ;
14
16
15
17
var gOPD = require ( 'gopd' ) ;
16
18
var oDP = Object . defineProperty ;
You can’t perform that action at this time.
0 commit comments