How to determine if a TypedArray is signed?
09:46 27 Nov 2025

I am working on a byte editor like DataView but with more features and I was wondering how to detect if a TypedArray was signed or not.

I already have this,

const signedTypes = new Set([
    Int8Array,
    Int16Array,
    Int32Array,
    BigInt64Array
]);

function isSigned(TypedArray) {
    return signedTypes.has(TypedArray.constructor);
}

But this seems too manual - for example, if there was a new signed TypedArray like 20 years into the future I'm going to have to go back to my source code and add it into the list.

I could also check if the name matches Int or BigInt but that feels too hacky.

Feedback is appreciated, Thanks 🙏

javascript unsigned signed dataview typed-arrays