Tuesday, 18 December 2012

Bug in Typescript when importing modules

After upgrading to Typescript and compiling your project, if you happen to import modules like this:

  1. import ModuleA = module("MyModule");
  2. export class MyType{
  3.     Foo: ModuleA.MyOtherType;
  4. }

you might encounter this error:

public member 'XXXX' of exported class has or is using private type 'YYYY'

It looks like a bug in Typescript After looking for an answer on the web, I found this discussion. Basically, the workaround is to make your imported module public by exporting them. Wait... what? Something like this:

  1. export import ModuleA = module("MyModule");

I guess that this will be fixed in a subsequent version.

    No comments:

    Post a Comment