json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

error for empty enums

Open pyramation opened this issue 3 years ago • 1 comments

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

pyramation avatar Jun 25 '22 20:06 pyramation

@pyramation I would like to work on this issue. Kindly assign me if I have your approval. Thank you.

ofekatr avatar Oct 04 '22 18:10 ofekatr