Typescript-ref Service Generator cant process IList<T>

We just generated the TypeScript version of our system. We found a few issues:

  1. IList<< T >> was not converted correctly to a TypeScript native type. However, it can convert an IEnumerable<< T>>

  2. For some reason, these ServiceStack interfaces and Classes had were included and had to be excluded

        nativeTypes.MetadataTypesConfig.ExcludeTypes = new List<string>
        {
            "IRequest",
            "IResponse",
            "IRequestPreferences",
            "HttpResult",
        };

Those are all server only implementation classes, none of them should be in your Services Contract.

You need to remove any references to those types in all of your DTOs, only the Response DTOs should be in your services contract, i.e. the Response Type returned in HttpResult, never the HttpResult class itself.

You’ll need to provide an example for the List<T> issue, note your DTOs should contain concrete types like List<T> not interfaces like IList<T>.

  1. Those Server Only implementation classes were not part of ANY of our DTO Base classes. We also not sure how they were included.

  2. The issues is when it generates this interface not a class.

    public interface ILocalSyncMessage
    {
    int Id { get; set; }
    string CacheMessageId { get; set; }

    IList To { get; set; }
    IList CC { get; set; }
    IList Bcc { get; set; }

    }
    We could try to convert them to List but that might have other problems in other places.

Also make sure they’re not included it in any IReturn<T> or other marker interfaces.

How is the interface used, does a Response DTO implement it or is it a property of a DTO? There shouldn’t be any interace properties.

We do use IReturn

[Route ("/AddAccount", "POST")]
public class AddAccount : DeviceDetailsRequestBase, IReturn<AddAccountResponse>

How is the interface used, does a Response DTO implement it or is it a property of a DTO? There shouldn’t be any interace properties.

Its a property

Use the concrete type properties in your DTOs, not the interface.

I mean you should never use HttpResult, IRequest, IResponse classes anywhere in your DTOs, including marker interfaces, e.g. IReturn<HttpResult>.

Converting the Interfaces on the responses will be some effort since its used in 100’s of places

We were able to get it to compile by replacing all

IList<RecipeCriteriaEmail> 

with

RecipeCriteriaEmail[] 

But we dont know if it will work at runtime??? And that is the default behavoir when it converts a IEnumerable<< T>>

Why not just rename it to List<RecipeCriteriaEmail>? Are you ever not using List<T> types for IList<T> properties?