ts2kt
ts2kt copied to clipboard
Handle union of string values
Fixes https://github.com/Kotlin/ts2kt/issues/95
Rebased and updated based on feedback.
@epabst it looks like comments meta-information is broken in
testData/typeAlias/typeParams.d.kt
Can you please verify on your side as well?
Great catch! What do you think it should look like since nesting the comments won't compile?
Let's discuss. It's seems to me following options are viable.
- Just leave
String | List<String | Number>
because actually the only way those comments are helpful now is as hints - and this is a perfectly valid hint. - Omit String | Number part completely.
First option looks nicer to me)
@Schahen I've fixed the issue with losing the comments and improved them as you've suggested. The fix initially broke nullability, which I then fixed, including adding more tests. The fix had a side-effect of preserving the original order of unioned types. Please re-review.