Skip to content

Error message when trying to call a class as a function is confusing #8062

Open
@kevinbarabash

Description

@kevinbarabash

The following code:

class Foo {};
const foo = Foo();

produces the following error message:

2: const foo = Foo();
               ^ Cannot call `Foo` because a call signature declaring the expected parameter / return type is missing in statics of `Foo` [1].
References:
1: class Foo {};
         ^ [1]

It would be clearer if error message stated that Foo is a constructor and must be called using new (or something to that effect).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions