I am very new to typescript. Here is a problem I need to solve. I already have the following:
const enum MyEnum {
...
};
export class A {
constructor(
...
public enu?: MyEnu,
public amount?: number,
) {
}
}
Now, I need to move the above two attributes into a class B. After a few tries, I haven't been able to figure out a right way. The following is one of my tries:
export class A {
constructor(
...
public b?: B,
) {
}
export class B {
constructor(
public enu?: MyEnu,
public amount?: number
) {
}
}
What will be a right way to define an embedded class in this case?
Updated: I try the following:
export interface IB{}
class B implements IB {
constructor(public enu?: MyEnu, public amount ?: number){}
}
export class A {
static B = B;
constructor(public b?: IB) { }
}
Without a luck.