1
- import * as ts from "./_namespaces/ts";
2
- import { moduleSpecifiers, performance } from "./_namespaces/ts";
3
1
import { bindSourceFile, getModuleInstanceState, ModuleInstanceState } from "./binder";
4
2
import {
5
3
addRange, and, append, appendIfUnique, arrayFrom, arrayOf, arraysEqual, arrayToMultiMap, binarySearch,
@@ -49,13 +47,15 @@ import {
49
47
} from "./factory/utilities";
50
48
import { setTextRange } from "./factory/utilitiesPublic";
51
49
import { getTypesPackageName, mangleScopedPackageName } from "./moduleNameResolver";
50
+ import * as moduleSpecifiers from "./moduleSpecifiers";
52
51
import {
53
52
forEachChild, forEachChildRecursively, isExternalModule, parseIsolatedEntityName, parseNodeFactory,
54
53
} from "./parser";
55
54
import {
56
55
comparePaths, fileExtensionIs, fileExtensionIsOneOf, getDirectoryPath, getNormalizedAbsolutePath, hasExtension,
57
56
pathIsRelative,
58
57
} from "./path";
58
+ import * as performance from "./performance";
59
59
import {
60
60
getModeForUsageLocation, getResolutionDiagnostic, getResolutionModeOverrideForClause,
61
61
isExclusivelyTypeOnlyImportOrExport, resolveTripleslashReference,
@@ -211,8 +211,8 @@ import {
211
211
getEffectiveConstraintOfTypeParameter, getEffectiveTypeParameterDeclarations, getJSDocClassTag,
212
212
getJSDocDeprecatedTag, getJSDocEnumTag, getJSDocParameterTags, getJSDocTags, getJSDocThisTag, getJSDocType,
213
213
getJSDocTypeTag, getNameOfDeclaration, getOriginalNode, getParseTreeNode, getTextOfJSDocComment, hasInitializer,
214
- hasJSDocNodes, hasJSDocParameterTags, hasOnlyExpressionInitializer, hasRestParameter, hasScopeMarker, idText ,
215
- isAccessor, isAssertionExpression, isAssignmentPattern, isBindingPattern, isCallChain, isCallLikeExpression,
214
+ hasJSDocNodes, hasJSDocParameterTags, hasOnlyExpressionInitializer, hasRestParameter, hasScopeMarker, hasType ,
215
+ idText, isAccessor, isAssertionExpression, isAssignmentPattern, isBindingPattern, isCallChain, isCallLikeExpression,
216
216
isCallOrNewExpression, isClassElement, isClassLike, isConstTypeReference, isDeclaration, isEntityName, isExpression,
217
217
isExpressionOfOptionalChainRoot, isExternalModuleIndicator, isExternalModuleNameRelative, isForInOrOfStatement,
218
218
isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, isFunctionOrModuleBlock,
@@ -965,6 +965,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
965
965
isPropertyAccessible,
966
966
getTypeOnlyAliasDeclaration,
967
967
getMemberOverrideModifierStatus,
968
+ typeHasCallOrConstructSignatures,
968
969
};
969
970
970
971
function runWithInferenceBlockedFromSourceNode<T>(node: Node | undefined, fn: () => T): T {
@@ -8835,7 +8836,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
8835
8836
8836
8837
function findResolutionCycleStartIndex(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): number {
8837
8838
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
8838
- if (hasType (resolutionTargets[i], resolutionPropertyNames[i])) {
8839
+ if (resolutionTargetHasType (resolutionTargets[i], resolutionPropertyNames[i])) {
8839
8840
return -1;
8840
8841
}
8841
8842
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -8845,7 +8846,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
8845
8846
return -1;
8846
8847
}
8847
8848
8848
- function hasType (target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
8849
+ function resolutionTargetHasType (target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
8849
8850
switch (propertyName) {
8850
8851
case TypeSystemPropertyName.Type:
8851
8852
return !!getSymbolLinks(target as Symbol).type;
@@ -17782,7 +17783,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
17782
17783
return false;
17783
17784
}
17784
17785
// Or functions with annotated parameter types
17785
- if (some(node.parameters, ts. hasType)) {
17786
+ if (some(node.parameters, hasType)) {
17786
17787
return false;
17787
17788
}
17788
17789
const sourceSig = getSingleCallSignature(source);
@@ -42826,7 +42827,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
42826
42827
}
42827
42828
42828
42829
function typeHasCallOrConstructSignatures(type: Type): boolean {
42829
- return ts.typeHasCallOrConstructSignatures (type, checker) ;
42830
+ return getSignaturesOfType(type, SignatureKind.Call).length !== 0 || getSignaturesOfType (type, SignatureKind.Construct).length !== 0 ;
42830
42831
}
42831
42832
42832
42833
function getRootSymbols(symbol: Symbol): readonly Symbol[] {
0 commit comments