Description
I made a mistake in part of the test case requested for #27.
is not valid.Unions of other simple types are being handled nicely - thank you again for adding this capability. But I didn't realize until having tsc
complain and then reading How to declare a type as nullable in TypeScript? (which coincidentally @bcherny submitted an answer) that the anotherValue?: null | string;
is not valid typescript. After reading the answers to this stackoverflow question I realize that anytime there are disjoint types for a property that includes null
, then null
should be filtered from the list of types and the property should become optional (which in the example test case coincidentally was).
Would you agree this is a correct interpretation of how to translate a disjoint type with null
in its list and transforming to a typescript interface? (If not, it's still a bug because null | string
is not valid according to tsc
. So I am open to other suggestions of how to handle disjoint types with null
in it.)
BTW: I saw this deeper in the comments of the above stackoverflow question: microsoft/TypeScript#7140. So it looks like this is just a bug with tsc
< 2.0
.