Skip to content

error for empty enums #463

Open
Open
@pyramation

Description

@pyramation

Empty enums such as this

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "QueryMsg",
  "type": "string",
  "enum": []
}

produces

export type QueryMsg = ()

which fails as the syntax is not correct

 FAIL  __tests__/index.test.js
  ✕ compiles (186 ms)

  ● compiles

    SyntaxError: '=>' expected. (9:1)
      7 |
      8 | export type QueryMsg = ()
    > 9 |

I've pushed an example that reproduces the exact error
https://github.com/pyramation/json-schema-to-typescript-sandbox/blob/main/__tests__/index.test.js#L4-L10

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions