TS2448
Block-scoped variable 'add' used before its declaration.
Broken Code ❌
Function expressions cannot be hoisted (used before they are declared):
add(1, 2);
const add = (a: number, b: number): number => {
return a + b;
};Fixed Code ✔️
Turn your function expression into a function declaration (which can be hoisted):
add(1, 2);
function add(a: number, b: number): number {
return a + b;
}