mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Replace non-null assertion with optional chain on assert nodes (#43788)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user