diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dc53215263b..d7558c12385 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -97,8 +97,9 @@ namespace ts { type ForEachChildFunction = (node: any, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined) => T | undefined; - const forEachChildTable: Array = []; - for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(undefined); + const forEachChildTable: (ForEachChildFunction | undefined)[] = []; + const forEachChildNoOpFn: ForEachChildFunction = (_node, _cbNode, _cbNodes) => undefined; + for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(forEachChildNoOpFn); forEachChildTable[SyntaxKind.QualifiedName] = forEachQualifiedName; forEachChildTable[SyntaxKind.TypeParameter] = forEachTypeParameter; forEachChildTable[SyntaxKind.ShorthandPropertyAssignment] = forEachShorthandPropertyAssignment;