Skip to content

Invalid auto-initialisation in typescript generator #1

Description

@vladkasianenko

In C# I have the model that contains:

public class MyDTO {
  public byte[] Timestamp { get; set; }
}

When I run npx get-dtos typescript https://localhost:5001, I get the next generated DTO:

export class MyDTO {
  public timestamp: string = [];
}

It converted byte array into base64 string correctly, however it added = [], which is not right.
The type of property is string, not string[]. It reports typescript error: Type 'undefined[]' is not assignable to type 'string'.ts(2322)

So it is expected to be:

export class MyDTO {
  public timestamp: string;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions