diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 75ab08de42ea0..6673b5c703b83 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -2242,8 +2242,10 @@ ContinuationIndenter::createBreakableToken(const FormatToken &Current, return nullptr; // Strings in TypeScript types and dictionary keys can not be broken. - if (Style.isJavaScript() && (Current.is(TT_SelectorName) || - State.Line->startsWith(Keywords.kw_type))) { + if (Style.isJavaScript() && + (Current.is(TT_SelectorName) || + State.Line->startsWith(Keywords.kw_type) || + State.Line->startsWith(tok::kw_export, Keywords.kw_type))) { return nullptr; } diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 309326569143d..51543d0a54d85 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1604,6 +1604,9 @@ TEST_F(FormatTestJS, StringLiteralConcatenation) { verifyFormat("/* type */ type x =\n" " 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';", getGoogleJSStyleWithColumns(20)); + verifyFormat("export type x =\n" + " 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';", + getGoogleJSStyleWithColumns(20)); // Dictionary keys can't be broken. Values can be broken. verifyFormat("var w = {\n" " 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx':\n"