I could not find any article about this.
How can i define a nested interface
inside a class
?
export class Car {
export interface Config {
name : string
}
constructor ( config : Config ) { }
}
You can't do it directly. But you can use namespace-class merging to achieve the desired effect at least from the point of you of an external consumer:
export class Car {
constructor(config: Car.Config) { }
}
namespace Car {
export interface Config {
name: string
}
}
let c: Car.Config;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With