Skip to main content
You are free to use methods from other classes but there are a few rules.

Importing is implicit

When referencing other classes and methods, our IDE will provide them to you directly in the scope. No need to write explicit import statements.
/* 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!')
    }
}

Dependencies are injected

The reason you don’t have to import anything is because we build an internal DI container. Any method calling another method, uses this DI container to reach it. This also means that if you were to instantiate classes manually, they will not be reachable by other methods.