diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -326,6 +326,7 @@ Compared to ``NextLine`` style, ``NextLineOnly`` style will not try to put the initializers on the current line first, instead, it will try to put the initializers on the next line only. +- Add support for the ``satisfies`` operator introduced in TypeScript 4.9. libclang -------- diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -1434,6 +1434,20 @@ EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_FunctionLBrace); } +TEST_F(TokenAnnotatorTest, UnderstandsTypeScriptSatisfiesOperator) { + auto Tokens = annotate("let x = foo satisfies Type;", + getGoogleStyle(FormatStyle::LK_JavaScript)); + ASSERT_EQ(Tokens.size(), 8u) << Tokens; + EXPECT_TOKEN(Tokens[0], tok::identifier, TT_Unknown); + EXPECT_TOKEN(Tokens[1], tok::identifier, TT_StartOfName); + EXPECT_TOKEN(Tokens[2], tok::equal, TT_BinaryOperator); + EXPECT_TOKEN(Tokens[3], tok::identifier, TT_Unknown); + EXPECT_TOKEN(Tokens[4], tok::identifier, TT_StartOfName); + EXPECT_TOKEN(Tokens[5], tok::identifier, TT_Unknown); + EXPECT_TOKEN(Tokens[6], tok::semi, TT_Unknown); + EXPECT_TOKEN(Tokens[7], tok::eof, TT_Unknown); +} + } // namespace } // namespace format } // namespace clang