TS1005
'{0}' expected.
Occurs when various syntax characters are making the code invalid.
Fix: '=' expected with type aliases
Unlike interfaces, type aliases must have a left hand side and right hand side of a statement, so code like this is invalid syntax:
type Person {
age: number;
name: string;
}
Instead it should look like this:
type Person = {
age: number;
name: string;
};
Fix: ';' expected with arrow functions
Code like this is trying to implicitly return an object with the map function, but is actually invalid syntax:
const items = [["a", 1], ["b", 2]];
const mapped = items.map(([key, value]) => { [key]: value });
Instead, use parenthesis (()
) around the return value:
const items = [["a", 1], ["b", 2]];
const mapped = items.map(([key, value]) => ({ [key]: value }));
Related: TS1002