This project is read-only.

Question about section 10.3 'Import Declarations'

Topics: General, Language Specification
Jul 26, 2013 at 10:25 PM
Consider a file with typescript code(eg: uid.ts):
module uid {
  var id = 1;

  export class Uid {
    value: number;

    constructor() {
      this.value = id++;

module uid_generator {
  import Uid = uid.Uid;

  function generate(): Uid {
    return new Uid();
When trying to compile this file(node.js, compiler version I get the following errors:
$ tsc uid.ts
/HOME/uid.ts(14,3): error TS2072: Module cannot be aliased to a non-module type.
/HOME/uid.ts(17,16): error TS2083: Invalid 'new' expression.
From what I understood by reading the section 10.3 'Import Declarations' of the language specification, this should be the correct way to create an alias for class 'Uid' inside module 'uid_generator'. What am I doing wrong?
Jul 27, 2013 at 1:11 AM
You're correct that this should work. We've recently fixed this bug, you'll find no error is reported for this code with the most recent bits in the develop branch.
Jul 27, 2013 at 10:10 AM
That is nice to know. Will you deploy a minor release containing with bugfix soon?

Thanks for the feedback.