function isTypedArray(val) {
    return val?.prototype?.__proto__?.constructor?.name === 'TypedArray';
}
Check if a value is a typed array.
@param {*} val The value to check.
@returns {boolean} True if the value is a `TypedArray`, false otherwise.

Adapted from https://stackoverflow.com/a/71091338/13989043