This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] conditional types.
ClosedPublic

Authored by mprobst on Sep 26 2018, 2:01 AM.

Details

Summary

This change adds some rudimentary support for conditional types.
Specifically it avoids breaking before extends and infer keywords,
which are subject to Automatic Semicolon Insertion, so breaking before
them creates incorrect syntax.

The actual formatting of the type expression is odd, but there is as of
yet no clear idea on how to format these.

See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#conditional-types.

Diff Detail

Event Timeline

mprobst created this revision.Sep 26 2018, 2:01 AM
krasimir accepted this revision.Sep 26 2018, 9:50 AM
krasimir added inline comments.
unittests/Format/FormatTestJS.cpp
2315

Add a comment that this formatting of the type expression is not yet clear (esp. I dislike the last line).

This revision is now accepted and ready to land.Sep 26 2018, 9:50 AM
mprobst updated this revision to Diff 167239.Sep 26 2018, 11:49 PM
  • comment in test
mprobst marked an inline comment as done.Sep 26 2018, 11:49 PM
This revision was automatically updated to reflect the committed changes.