typescript-json-schema
typescript-json-schema copied to clipboard
`constAsEnum` not aways working in combination with `strictNullChecks`
The following example still in one case generates const instead of enum:
type A = B | C
interface B {
myProp?: false
}
interface C {
myProp: true
}
When generating the schema like this:
typescript-json-schema --constAsEnum --strictNullChecks test.ts A
The outcome is:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{
"$ref": "#/definitions/B"
},
{
"$ref": "#/definitions/C"
}
],
"definitions": {
"B": {
"properties": {
"myProp": {
"const": false,
"type": "boolean"
}
},
"type": "object"
},
"C": {
"properties": {
"myProp": {
"enum": [
true
],
"type": "boolean"
}
},
"type": "object"
}
}
}
@domoritz do you still maintain this package? Any thoughts about this problem?
I don't use it anymore but merge PRs and make releases. I don't have time to triage or fix issues.