mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
@@ -497,6 +497,8 @@ namespace ts {
|
||||
const builtinGlobals = createSymbolTable();
|
||||
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
||||
|
||||
const isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
||||
|
||||
initializeTypeChecker();
|
||||
|
||||
return checker;
|
||||
@@ -22257,7 +22259,7 @@ namespace ts {
|
||||
if (flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) {
|
||||
return;
|
||||
}
|
||||
const exportedDeclarationsCount = countWhere(declarations, isNotOverload);
|
||||
const exportedDeclarationsCount = countWhere(declarations, isNotOverloadAndNotAccessor);
|
||||
if (flags & SymbolFlags.TypeAlias && exportedDeclarationsCount <= 2) {
|
||||
// it is legal to merge type alias with other values
|
||||
// so count should be either 1 (just type alias) or 2 (type alias + merged value)
|
||||
@@ -22273,11 +22275,16 @@ namespace ts {
|
||||
});
|
||||
links.exportsChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function isNotOverload(declaration: Declaration): boolean {
|
||||
return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) ||
|
||||
!!(declaration as FunctionDeclaration).body;
|
||||
}
|
||||
function isNotAccessor(declaration: Declaration): boolean {
|
||||
// Accessors check for their own matching duplicates, and in contexts where they are valid, there are already duplicate identifier checks
|
||||
return !isAccessor(declaration);
|
||||
}
|
||||
|
||||
function isNotOverload(declaration: Declaration): boolean {
|
||||
return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) ||
|
||||
!!(declaration as FunctionDeclaration).body;
|
||||
}
|
||||
|
||||
function checkSourceElement(node: Node): void {
|
||||
|
||||
@@ -2626,4 +2626,8 @@ namespace ts {
|
||||
export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) {
|
||||
return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs;
|
||||
}
|
||||
|
||||
export function and<T>(f: (arg: T) => boolean, g: (arg: T) => boolean) {
|
||||
return (arg: T) => f(arg) && g(arg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user