Skip to content

[jsc-to-ts] enum with null value throws #39

@RedHatter

Description

@RedHatter

Using a enum with a null value as shown here throws.

TypeError: Cannot destructure property 'properties' of 'node' as it is null.
    at tsObjectType (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:205:13)
    at tsConstType (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:185:31)
    at file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:139:30
    at Array.map (<anonymous>)
    at tsType (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:139:18)
    at tsTypeAndOrSchema (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:109:16)
    at file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:100:76
    at Array.map (<anonymous>)
    at tsTypeUnion (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:100:48)
    at tsTypeAndOr (file:///home/ava/peach-front/node_modules/core-types-ts/dist/lib/core-types-to-ts.js:115:16)

{
  "enum": ["red", "amber", "green", null, 42]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions