Closed domdomegg closed 3 years ago
Hello @domdomegg !
It seems working fine on my part. Can you check you have activated the strictNullCheck
or strict
option in your tsconfig.json
file ?
You are correct - enabling strictNullChecks
in my tsconfig fixes the problem! Apologies for the incorrect report and thanks for such a great library :raised_hands:.
Summary
anyOf and arrays of types in JSON schemas does not appear to behave correctly with nulls. Instead of unioning the type with null, nothing seems to happen.
Details
json-schema-to-ts version: 1.6.4 typescript version: 4.4.3
Example
In both these examples,
MyType
should bestring | null
, but is insteadstring