Skip to content

Missing enum key from typescript string enums #1158

Description

@9bic

I tried to convert from typescript with TS string enums, not returns enum keys.
When enum values are string, returns key correctly. It seems that when enum values passes parseInt(), return The${value}.

convert

quicktype --src enum.ts --lang typescript --out out.ts --just-types

enum.ts

enum TestEnumWithString {
  Foo = "foo",
  Bar = "bar",
  Baz = "baz"
}

enum TestEnum {
  Foo = "000",
  Bar = "001",
  Baz = "002"
}

out.ts

NOTE: I also tried to convert to Swift, and got similar result

export enum TestEnumWithString {
    Bar = "bar",
    Baz = "baz",
    Foo = "foo",
}

export enum TestEnum {
    The000 = "000",
    The001 = "001",
    The002 = "002",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions