Skip to content

Commit 642060d

Browse files
authored
Replace non-null assertion with optional chain on assert nodes (microsoft#43788)
1 parent c23abc8 commit 642060d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/debug.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ namespace ts {
221221
assert(
222222
node !== undefined && (test === undefined || test(node)),
223223
message || "Unexpected node.",
224-
() => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`,
224+
() => `Node ${formatSyntaxKind(node?.kind)} did not pass test '${getFunctionName(test!)}'.`,
225225
stackCrawlMark || assertNode);
226226
}
227227
}
@@ -246,7 +246,7 @@ namespace ts {
246246
assert(
247247
test === undefined || node === undefined || test(node),
248248
message || "Unexpected node.",
249-
() => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`,
249+
() => `Node ${formatSyntaxKind(node?.kind)} did not pass test '${getFunctionName(test!)}'.`,
250250
stackCrawlMark || assertOptionalNode);
251251
}
252252
}
@@ -259,7 +259,7 @@ namespace ts {
259259
assert(
260260
kind === undefined || node === undefined || node.kind === kind,
261261
message || "Unexpected node.",
262-
() => `Node ${formatSyntaxKind(node!.kind)} was not a '${formatSyntaxKind(kind)}' token.`,
262+
() => `Node ${formatSyntaxKind(node?.kind)} was not a '${formatSyntaxKind(kind)}' token.`,
263263
stackCrawlMark || assertOptionalToken);
264264
}
265265
}

0 commit comments

Comments
 (0)