svenheden / csharp-models-to-typescript

C# models to TypeScript
88 stars 58 forks source link

Custom type Translation from byte[] isn't working #33

Open vanilsonbr opened 5 years ago

vanilsonbr commented 5 years ago

I can't convert the type byte[] to another type, causing my typescript file to output incorrect types. Example: Config file:

{
  "customTypeTranslations": {
    "byte[]" : "string"
  }
}

Source c# file:

public class Test {
  public string Name { get; set; }
  public byte[] Data { get; set; }
}

output typescript file content:

export interface Test {
  name: string;
  data: byte[] //should be string
}

I've created another custom type translations, like TimeSpan to string and even KeyValuePair<string, string> to { key: string; value: string; } and it worked file, but byte[] to string isn't working.

Any ideias on this?

Thanks in advance.

digocesar commented 2 years ago

I want to convert byte[] as ArrayBuffer and the customTypeTranslations is not working. Will the PR #43 be accepted? Or should the conversion set byte[] as ArrayBuffer directly?