Generated TS code has changed after an update from ServiceStack 5.10 to 5.11


raw data responses in generated TS code has changed after an update from ServiceStack 5.10 to 5.11

Responses of byte[] are now string instead of Uint8Array in the generated TS code.
Is this a mistake or has this been intentionally changed.


It was changed to string to match its Base64 string response property type.

You can change it back with:

TypeScriptGenerator.TypeAliases[typeof(Byte[]).Name] = "Uint8Array";

What does your DTO look like, e.g. Are you using the byte[] as the property type or the return type?

FYI I’ve just added the ability to define different aliases for return types in this commit where a byte[] array property will be generated to use string to capture its Base64 string returned in JSON APIs whilst if the entire response is binary, e.g. returns byte[] or Stream it will be generated to use a Blob type, e.g. the C# Request DTO with a byte[] property and Return Type:

public class ReturnBytes : IReturn<byte[]>
    public byte[] Data { get; set; }

Will generate the following TypeScript DTO:

export class ReturnBytes implements IReturn<Blob>
    public data: string;

    public constructor(init?: Partial<ReturnBytes>) { (Object as any).assign(this, init); }
    public createResponse() { return new Blob(); }
    public getTypeName() { return 'ReturnBytes'; }

This change is available in the latest v5.11.1 that’s now available on MyGet.

Thanks for the quick response. In our case the byte[] was the return type. I think your last adjustment is very good and fits most scenarios. But I also love the flexibility, so we can customize it according to our needs.