TS1064

error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write ‘Promise ‘?

Broken Code ❌

1
2
3
async function myFunction(): string {
return 'test';
}

Fixed Code ✔️

If your function is asynchronous, your return value must be wrapped with Promise<...>:

1
2
3
async function myFunction(): Promise<string> {
return 'test';
}