/* No import statement here */
class Docker {
readonly shouldCrash?: boolean;
/* You just add dependencies as members */
public sideCar: SideCar;
/**
* You can also have a nested object acting as a dependency and it
* will be handled automatically.
*/
public dependencies: {
external: {
/* Usable as this.dependencies.external.sideCar */
sideCar: SideCar,
}
}
container() {
if (this.shouldCrash) {
return 'exiting with code 1';
}
/* The following two calls will reach the same method */
this.sideCar.log('hello world!');
this.dependencies.external.sideCar.log('hello again!')
}
}