diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 9fccb9ea996e0..3d3f9fea6ba15 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1546,11 +1546,11 @@ namespace ts { export namespace Debug { let isDebugInfoEnabled = false; - export const failBadSyntaxKind = shouldAssert(AssertionLevel.Normal) - ? (node: Node, message?: string): never => fail( + export function failBadSyntaxKind(node: Node, message?: string): never { + return fail( `${message || "Unexpected node."}\r\nNode ${formatSyntaxKind(node.kind)} was unexpected.`, - failBadSyntaxKind) - : noop as () => never; // TODO: GH#22091 + failBadSyntaxKind); + } export const assertEachNode = shouldAssert(AssertionLevel.Normal) ? (nodes: Node[], test: (node: Node) => boolean, message?: string): void => assert(