Typescript circular reference problem

there are two classes as follows

// Parent.ts
import {Sub} from "./Sub";

export class Parent {
   public getSub() {
        return new Sub();
    }
}
// Sub.ts
import {Parent} from "./Parent";

export class Sub extends Parent {}

running js after ts compilation throws an error

Uncaught TypeError: Object prototype may only be an Object or null: undefined

it seems that the ts compiler defines the Sub class first when it sees a reference to the Sub class in the Parent class, and before the Parent class is defined, it will cause Parent to throw a TypeError. for the undefined,

.

how can I change it to let the ts compiler define Parent first

Feb.28,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9fdf5-2f4ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9fdf5-2f4ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?