TS2813

error TS2813: Class declaration cannot implement overload list for ‘MyClass’.

Solution

Bad Code ❌

1
2
3
4
5
class MyClass {
}

function MyClass(): void {
}

Function declarations get hoisted, so you cannot give your class the name of your function. Renaming your class solves the issue:

Fixed Code ✔️

1
2
3
4
5
class MyClassWithAnotherName {
}

function MyClass(): void {
}