From 642060db6f64f8e6c2f7f09dd962c07ad2be6db3 Mon Sep 17 00:00:00 2001 From: Armando Aguirre Date: Mon, 2 Aug 2021 15:26:48 -0700 Subject: [PATCH] Replace non-null assertion with optional chain on assert nodes (#43788) --- src/compiler/debug.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index fc7b1aa4cdb..2e6b87a30e6 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -221,7 +221,7 @@ namespace ts { assert( node !== undefined && (test === undefined || test(node)), message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`, + () => `Node ${formatSyntaxKind(node?.kind)} did not pass test '${getFunctionName(test!)}'.`, stackCrawlMark || assertNode); } } @@ -246,7 +246,7 @@ namespace ts { assert( test === undefined || node === undefined || test(node), message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`, + () => `Node ${formatSyntaxKind(node?.kind)} did not pass test '${getFunctionName(test!)}'.`, stackCrawlMark || assertOptionalNode); } } @@ -259,7 +259,7 @@ namespace ts { assert( kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node!.kind)} was not a '${formatSyntaxKind(kind)}' token.`, + () => `Node ${formatSyntaxKind(node?.kind)} was not a '${formatSyntaxKind(kind)}' token.`, stackCrawlMark || assertOptionalToken); } }