TS2322

error TS2322: Type ‘Promise<{}>’ is not assignable to type ‘Promise

Bad Code ❌

1
2
3
4
function remove(prekey_id: number): Promise<void> {
this.removed_prekeys.push(prekey_id);
return Promise.resolve();
}

Fixed Code ✔️

1
2
3
4
function remove(prekey_id: number): Promise<void> {
this.removed_prekeys.push(prekey_id);
return Promise.resolve(undefined);
}