Guid support (must be convert to string)

Issue #7 resolved
Anonymous created an issue

TypeLite could convert Guid type to a javascript string.

Comments (6)

  1. sebavdp

    It would be nice to have something similar to this.

        .WithTypeConverter<System.Guid>(type => { return "string" })

    Then I can also easily convert everything for knockout.

    I am using the folling knockout typescript definition

    Changing every type to a observable like this

        .WithTypeConverter<string>(type => { return "KnockoutObservable<string>" })
        .WithTypeConverter<bool>(type => { return "KnockoutObservable<boolean>" })
        .WithTypeConverter<int>(type => { return "KnockoutObservable<number>" })
        .WithTypeConverter<short>(type => { return "KnockoutObservable<number>" })
        .WithTypeConverter<long>(type => { return "KnockoutObservable<number>" })
        .WithTypeConverter<DateTime>(type => { return "KnockoutObservable<Date>" })
  2. Michael Durling

    Is there a way to have TypeLite wrap all properties and collections for Knockout. Basically, I want to use .WithConvertor for change a type (as in the Guid example where it generated as a string. Then, however, I want to wrap all types, T, as KnockoutObservable<T> and all collections, T[], as KnockoutObservableArray<T>. I don't want to do this on an type-by-type basis as above so it's really more of a formatting issue. I see there are extension points for formatting class and member names, but not their types. Is there a way to tell TypeLite how to format an instance of a type and a collection of a type?

  3. Log in to comment