Skip to content

Extending an ES6 class with a CS class fails #4233

Closed
@bcherny

Description

@bcherny

CoffeeScript calls classes as functions (rather than newing them as constructors) when instantiating a class that inherits from an ES6 class.

The fix is to interoperate with ES6 classes - no need to go all the way and compile Coffee to ES6 classes. We should check to see if a class is an ES6 class, and treat it differently (eg. see what angular does here).

Test case:

js:

class A {}

coffee:

class B extends A {}
new B # TypeError: Class constructor A cannot be invoked without 'new'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions