TS1183

error TS1183: An implementation cannot be declared in ambient contexts.

Broken Code ❌

index.d.ts
1
2
3
export function logSomething(error: unknown): void {
console.log('something');
}

Fixed Code ✔️

You cannot write a function implementation inside a declaration file (*.d.ts). You can only declare its signature:

index.d.ts
1
export function logSomething(error: unknown): void;

Alternatively, you can write your function implementation inside a source code file (*.ts).