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 {
@@ -8816,7 +8817,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
8816
8817
8817
8818
function findResolutionCycleStartIndex(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): number {
8818
8819
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
8819
- if (hasType (resolutionTargets[i], resolutionPropertyNames[i])) {
8820
+ if (resolutionTargetHasType (resolutionTargets[i], resolutionPropertyNames[i])) {
8820
8821
return -1;
8821
8822
}
8822
8823
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -8826,7 +8827,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
8826
8827
return -1;
8827
8828
}
8828
8829
8829
- function hasType (target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
8830
+ function resolutionTargetHasType (target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean {
8830
8831
switch (propertyName) {
8831
8832
case TypeSystemPropertyName.Type:
8832
8833
return !!getSymbolLinks(target as Symbol).type;
@@ -17750,7 +17751,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
17750
17751
return false;
17751
17752
}
17752
17753
// Or functions with annotated parameter types
17753
- if (some(node.parameters, ts. hasType)) {
17754
+ if (some(node.parameters, hasType)) {
17754
17755
return false;
17755
17756
}
17756
17757
const sourceSig = getSingleCallSignature(source);
@@ -42642,7 +42643,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
42642
42643
}
42643
42644
42644
42645
function typeHasCallOrConstructSignatures(type: Type): boolean {
42645
- return ts.typeHasCallOrConstructSignatures (type, checker) ;
42646
+ return getSignaturesOfType(type, SignatureKind.Call).length !== 0 || getSignaturesOfType (type, SignatureKind.Construct).length !== 0 ;
42646
42647
}
42647
42648
42648
42649
function getRootSymbols(symbol: Symbol): readonly Symbol[] {
0 commit comments