File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Expand file tree Collapse file tree 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' ;
132
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 ;
1512declare function typedArrayByteOffset ( value : unknown ) : false ;
1613
1714export = typedArrayByteOffset ;
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ var gPO = require('reflect.getprototypeof/polyfill')();
66
77var typedArrays = require ( 'available-typed-arrays' ) ( ) ;
88
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 */
1110
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+ } ;
1416
1517var gOPD = require ( 'gopd' ) ;
1618var oDP = Object . defineProperty ;
You can’t perform that action at this time.
0 commit comments