Tuesday, 18 December 2012

Bug in Typescript 0.8.1.1 when importing modules

After upgrading to Typescript 0.8.1.1 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 0.8.1.1. 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.