The typeof type operator

    TypeScript adds a typeof operator you can use in a type context to refer to the type of a variable or property:

    If we try to use ReturnType on a function name, we see an instructive error:

      TypeScript intentionally limits the sorts of expressions you can use typeof on.

      1. // Meant to use = ReturnType<typeof msgbox>
        let shouldContinue: typeof msgbox("Are you sure you want to continue?");
        ',' expected.1005',' expected.