Skip to content

Playground is not supporting for "wrong order" classes #8633

Closed

Description

@xsetion

Actual behavior:

I write two classes in the playground and when I run the code I get an error in the console which land on the extend function.

class Snake extends Greeter {
constructor() {
super();
}
skip(){}
}
class Greeter {
constructor() {}

skip(){
    console.log('nothig to skip');
    this.preEnd();
    console.log('so just ended');
}
preEnd(){}

}

Expected behavior:

The order of the class should not matter.

Activity

  1. jeffreymorlan commented on May 17, 2016

    @jeffreymorlan
    Contributor

    Unlike functions, a class isn't actually created until its class declaration is reached, so it can't be forward referenced.

  2. DanielRosenwasser commented on May 17, 2016

    @DanielRosenwasser
    Member

    This is correct. Classes need to be declared before they are referenced on their value side.

  3. added
    BugA bug in TypeScript
    FixedA PR has been merged for this issue
    and removed
    Working as IntendedThe behavior described is the intended behavior; this is not a bug
    on Jul 29, 2016
  4. RyanCavanaugh commented on Jul 29, 2016

    @RyanCavanaugh
    Member

    This will now issue an error in cases where we can tell it's guaranteed not to work

  5. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions