2

I have a requirement to load some module first of all, because this module is needed in inheritance. The problem is that TypeScript start extending immediately even if the base class has not been loaded. The question is: is there any plugin which can change loading order? Thanks.

Context.ts

import { Transform } from './Transform';
import { Form } from './Form';

export class Context {

    public transform() {
        return new Transform(this);
    }

    public toFormContext() {
        return new Form(this);
    }
}

Transform.ts

import { Context } from './Context';

export class Transform extends Context {

    constructor(base: Context) {
        super();
    }

}

Form.ts

import { Context } from './Context';

export class Form extends Context {

    constructor(base: Context) {
        super();
    }

}

I need to tell webpack that Context.ts should be loaded first of all, because the others are needed in it higher than Context.ts in them as it address to them in runtime, but the others address Context.ts immediately.

aspirisen
  • 965
  • 13
  • 29
  • Can you add a minimal example that lets us replicate the issue? I don't think TypeScript is doing what you suspect it's doing. – mk. Dec 09 '15 at 18:45
  • @mk. Added some examples – aspirisen Dec 09 '15 at 20:51
  • 1
    You've got circular imports. See http://stackoverflow.com/q/30378226/154066 . You could put all of these in the same file as a workaround. – mk. Dec 09 '15 at 20:58
  • @mk. Yes, it works, until we have a circular dependency on itself. For example I have a class Component which extends Reac.Componenr, all the components are extended from this class. But i want to set default error handler (modal window with the error and feedback button) for all these descendants, and the handler is also a component... – aspirisen Dec 11 '15 at 05:06

0 Answers0