Properties with System.Guid type result in invalid typescript code

Issue #6 resolved
jamie_tillman
created an issue

When transforming a class like this:

  // In namespace ViewModel
    public class LocationDto
    {
        public Guid Id { get; set; }
    }

The TypeLite library creates this:

module ViewModel {
interface LocationDto {
  Id: Guid;
}
module System {
  interface Guid {
  }
}

This results in code that won't compile in TypeScript because the Guid interface is declared in a different module from the DTO class.

If you move the Guid interface declaration to the "ViewModel" module in the generated code above, the code will compile.

Comments (3)

  1. jamie_tillman reporter

    Looking at this issue more closely, it seems a good solution might be to fully qualify the typename of the property:

    Id: System.Guid;
    

    This seems to work and allows the Guid definition to reside in the System module as intended.

  2. Log in to comment