#Circular Dependencies in class

2 messages · Page 1 of 1 (latest)

coarse crest
#

Can I have a static variable in a class that is a member of another class that extends the first class? For example:

Foo.ts

class Foo {
  static Dummy = new Bar();
  
  ...

}

Bar.ts

class Bar extends Foo {
  constructor(){
    super();
  }

  ...

}

Is there a way to make this work?

fluid leaf
#

@coarse crest Doesn't seem like that'd be possible - the Foo class has to exist before the Bar class can be defined.