diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8df1f8bf808..e1f99882079 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12680,6 +12680,10 @@ namespace ts { break; case SyntaxKind.FunctionExpression: case SyntaxKind.ClassExpression: + // The reason we are not using copySymbol for function expression and class expression + // is that copySymbol will not copy a symbol into SymbolTable if the symbol has name prefix + // with "__". Therefore, if class expression or function expression have declared name, + // we will add the symbol into the table using its declared name let name = (location).name; if (name) { let symbol = location.symbol;