TS1109
Expression expected.
Broken Code ❌
const lastName = throw new Error('Missing last name');Fixed Code ✔️
Any snippet of code that evaluates to a value is an expression. Any snippet of code that performs an action is a statement. We need a statement to throw an error inside:
const lastName = undefined;
if (!lastName) {
throw new Error('Missing last name');
}