Skip to content

Array of Enum with --enum-values creates 2-D Type, but 1-D values #1856

Open
@stefan-huck

Description

@stefan-huck

The generated --enum-values schema.ts file creates a 2-D Type and 1-D values.

Spec:

someList:
  type: array
  items:
    type: string
    enum:
    - One
    - Two
    - Three

Schema File:

export const someListValues: ReadonlyArray<components["..."]["..."]["someList"]> = ["One", "Two", "Three"]
//  ^? const someListValues: readonly ("One" | "Two" | "Three")[][]
// See double square brackets

Expected

//  ^? const someListValues: readonly ("One" | "Two" | "Three")[]

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript library

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions