TS1005

error TS1005: ‘=’ expected.

Broken Code ❌

1
2
3
4
type Person {
age: number;
name: string;
}

Fixed Code ✔️

You need to assign your type declaration using the = character:

1
2
3
4
type Person = {
age: number;
name: string;
}

Alternatively you can declare an interface:

1
2
3
4
interface Person {
age: number;
name: string;
}

error TS1005: ‘;’ expected.

Broken Code ❌

1
2
3
export function requireEnvs(name: string[]): Record<string, string> {
const names = name.map(name => {[name]: requireEnv(name)});
}

Fixed Code ✔️

Use an implicit return:

1
2
3
export function requireEnvs(name: string[]): Record<string, string> {
const names = name.map(name => ({[name]: requireEnv(name)}));
}