microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.51k forks source link

class implements Awaited<any> [bug] #60568

Open MaxmaxmaximusFree opened 1 day ago

MaxmaxmaximusFree commented 1 day ago

🔎 Search Terms

implements Awaited bug

🕗 Version & Regression Information

⏯ Playground Link

No response

💻 Code

This works:

async function test() {

    class Cat implements Awaited<any> {

    }

    await new Cat()
}

but This error:

async function test() {

    class Cat implements Awaited<any> {
        then(){ }
    }

    await new Cat()
}

Image

🙁 Actual behavior

bug

🙂 Expected behavior

normal await

Additional information about the issue

No response

MartinJohns commented 1 day ago

You forgot to fill out the issue template.

What makes you think this is a bug? The error message indicates this is intentional. Also, Awaited<any> resolves to get any, so you're trying to implement any.