Skip to content

Commit

Permalink
fix: use ArrayBuffer.isView instead of constructor
Browse files Browse the repository at this point in the history
TypedArray cannot be polyfilled and throw error like 'BigInt64Array is not defined'
  • Loading branch information
wqcstrong committed Jul 24, 2023
1 parent a0d3f00 commit c6b61da
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,7 @@ type TypedArray =
| BigInt64Array
| BigUint64Array;
export function isTypedArray(value: unknown): value is TypedArray {
return [
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array,
BigInt64Array,
BigUint64Array,
].includes(Object.getPrototypeOf(value).constructor);
return ArrayBuffer.isView(value);
}

interface PrimitiveResult {
Expand Down

0 comments on commit c6b61da

Please sign in to comment.