How do I do with typescript when I have a
Cat
which has anowner: Person
Person
which ownspet: Cat
Cat
import {Person} from './person'
export class Cat {
owner: Person
constructor(){
this.owner = new Person()
}
}
Person
import {Cat} from './cat'
export class Person {
pet: Cat
constructor(){
this.pet = new Cat()
}
}
hope there is a good solution and pattern other than workaround like having:
- both classes into the same file
- a third class
don't say me that typescript compiler didn't think about that case :$