Replace non-null assertion with optional chain on assert nodes (#43788)

This commit is contained in:
Armando Aguirre
2021-08-02 15:26:48 -07:00
committed by GitHub
parent c23abc8957
commit 642060db6f

View File

@@ -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);
}
}