ts2kt icon indicating copy to clipboard operation
ts2kt copied to clipboard

Handle union of string values

Open epabst opened this issue 6 years ago • 5 comments

Fixes https://github.com/Kotlin/ts2kt/issues/95

epabst avatar Sep 18 '18 04:09 epabst

Rebased and updated based on feedback.

epabst avatar Nov 13 '18 13:11 epabst

@epabst it looks like comments meta-information is broken in testData/typeAlias/typeParams.d.kt

Can you please verify on your side as well? screen shot 2018-11-29 at 2 22 51 pm

Schahen avatar Nov 29 '18 13:11 Schahen

Great catch! What do you think it should look like since nesting the comments won't compile?

epabst avatar Nov 29 '18 13:11 epabst

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 avatar Nov 29 '18 13:11 Schahen

@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.

epabst avatar Dec 27 '18 18:12 epabst