Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -1804,7 +1804,7 @@ Line.First->isOneOf(Keywords.kw_import, tok::kw_export)) return false; if (Left.is(TT_TemplateCloser) && - !Right.isOneOf(tok::l_brace, tok::comma, tok::l_square, + !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square, Keywords.kw_implements, Keywords.kw_extends)) // Type assertions ('expr') are not followed by whitespace. Other // locations that should have whitespace following are identified by the Index: unittests/Format/FormatTestJS.cpp =================================================================== --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -687,6 +687,8 @@ verifyFormat("foo(a);"); verifyFormat("var x: X[];"); verifyFormat("class C extends D implements F, H {}"); + verifyFormat("function f(a: List = null) {\n}"); + verifyFormat("function f(): List {\n}"); } TEST_F(FormatTestJS, OptionalTypes) {