Replace a 'forEach' with 'find' (#17499)

This commit is contained in:
Andy
2017-07-28 19:03:47 -07:00
committed by GitHub
parent 2efaa7c9e2
commit b0435d8490

View File

@@ -19530,10 +19530,9 @@ namespace ts {
// Since the javascript won't do semantic analysis like typescript,
// if the javascript file comes before the typescript file and both contain same name functions,
// checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
const firstDeclaration = forEach(localSymbol.declarations,
const firstDeclaration = find(localSymbol.declarations,
// Get first non javascript function declaration
declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFileOfNode(declaration)) ?
declaration : undefined);
declaration => declaration.kind === node.kind && !isSourceFileJavaScript(getSourceFileOfNode(declaration)));
// Only type check the symbol once
if (node === firstDeclaration) {