Closed
Description
I receive the following warning in Visual Studio
TS6387 (JS) The signature '(from: number, length?: number): string' of 'str.substr' is deprecated. signalr.js 380
The affected code seems to be:
function formatArrayBuffer(data) {
const view = new Uint8Array(data);
// Uint8Array.map only supports returning another Uint8Array?
let str = "";
view.forEach((num) => {
const pad = num < 16 ? "0" : "";
str += `0x${pad}${num.toString(16)} `;
});
// Trim of trailing space.
return str.substr(0, str.length - 1);
}
Seems to be simple, use str.substring
instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr