3 ms·
If you want to type an array, you can do that in Typescript. let x:number[] = []; x.push("x"); Here, the transpiler will catch the error of trying to push a s
by sonnyblarney 8y ago
If you want to type an array, you can do that in Typescript.
let x:number[] = [];
x.push("x");
Here, the transpiler will catch the error of trying to push a string to a number array.
Typing is your friend, and it will in almost all cases help you write cleaner and safer code.