typescript 5.5.0-dev.20240327 → 5.5.0-dev.20240329
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.core.d.ts +40 -0
- package/lib/lib.es2020.bigint.d.ts +2 -2
- package/lib/tsc.js +373 -304
- package/lib/typescript.d.ts +6 -3
- package/lib/typescript.js +448 -360
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240329`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3699,6 +3699,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3699
3699
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3700
3700
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3701
3701
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3702
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3702
3703
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3703
3704
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3704
3705
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -17697,6 +17698,91 @@ function isSyntacticallyString(expr) {
|
|
|
17697
17698
|
}
|
|
17698
17699
|
return false;
|
|
17699
17700
|
}
|
|
17701
|
+
function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
|
|
17702
|
+
function evaluate(expr, location) {
|
|
17703
|
+
switch (expr.kind) {
|
|
17704
|
+
case 224 /* PrefixUnaryExpression */:
|
|
17705
|
+
const value = evaluate(expr.operand, location);
|
|
17706
|
+
if (typeof value === "number") {
|
|
17707
|
+
switch (expr.operator) {
|
|
17708
|
+
case 40 /* PlusToken */:
|
|
17709
|
+
return value;
|
|
17710
|
+
case 41 /* MinusToken */:
|
|
17711
|
+
return -value;
|
|
17712
|
+
case 55 /* TildeToken */:
|
|
17713
|
+
return ~value;
|
|
17714
|
+
}
|
|
17715
|
+
}
|
|
17716
|
+
break;
|
|
17717
|
+
case 226 /* BinaryExpression */:
|
|
17718
|
+
const left = evaluate(expr.left, location);
|
|
17719
|
+
const right = evaluate(expr.right, location);
|
|
17720
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
17721
|
+
switch (expr.operatorToken.kind) {
|
|
17722
|
+
case 52 /* BarToken */:
|
|
17723
|
+
return left | right;
|
|
17724
|
+
case 51 /* AmpersandToken */:
|
|
17725
|
+
return left & right;
|
|
17726
|
+
case 49 /* GreaterThanGreaterThanToken */:
|
|
17727
|
+
return left >> right;
|
|
17728
|
+
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
17729
|
+
return left >>> right;
|
|
17730
|
+
case 48 /* LessThanLessThanToken */:
|
|
17731
|
+
return left << right;
|
|
17732
|
+
case 53 /* CaretToken */:
|
|
17733
|
+
return left ^ right;
|
|
17734
|
+
case 42 /* AsteriskToken */:
|
|
17735
|
+
return left * right;
|
|
17736
|
+
case 44 /* SlashToken */:
|
|
17737
|
+
return left / right;
|
|
17738
|
+
case 40 /* PlusToken */:
|
|
17739
|
+
return left + right;
|
|
17740
|
+
case 41 /* MinusToken */:
|
|
17741
|
+
return left - right;
|
|
17742
|
+
case 45 /* PercentToken */:
|
|
17743
|
+
return left % right;
|
|
17744
|
+
case 43 /* AsteriskAsteriskToken */:
|
|
17745
|
+
return left ** right;
|
|
17746
|
+
}
|
|
17747
|
+
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
17748
|
+
return "" + left + right;
|
|
17749
|
+
}
|
|
17750
|
+
break;
|
|
17751
|
+
case 11 /* StringLiteral */:
|
|
17752
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
17753
|
+
return expr.text;
|
|
17754
|
+
case 228 /* TemplateExpression */:
|
|
17755
|
+
return evaluateTemplateExpression(expr, location);
|
|
17756
|
+
case 9 /* NumericLiteral */:
|
|
17757
|
+
return +expr.text;
|
|
17758
|
+
case 217 /* ParenthesizedExpression */:
|
|
17759
|
+
return evaluate(expr.expression, location);
|
|
17760
|
+
case 80 /* Identifier */:
|
|
17761
|
+
return evaluateEntityNameExpression(expr, location);
|
|
17762
|
+
case 211 /* PropertyAccessExpression */:
|
|
17763
|
+
if (isEntityNameExpression(expr)) {
|
|
17764
|
+
return evaluateEntityNameExpression(expr, location);
|
|
17765
|
+
}
|
|
17766
|
+
break;
|
|
17767
|
+
case 212 /* ElementAccessExpression */:
|
|
17768
|
+
return evaluateElementAccessExpression(expr, location);
|
|
17769
|
+
}
|
|
17770
|
+
return void 0;
|
|
17771
|
+
}
|
|
17772
|
+
function evaluateTemplateExpression(expr, location) {
|
|
17773
|
+
let result = expr.head.text;
|
|
17774
|
+
for (const span of expr.templateSpans) {
|
|
17775
|
+
const value = evaluate(span.expression, location);
|
|
17776
|
+
if (value === void 0) {
|
|
17777
|
+
return void 0;
|
|
17778
|
+
}
|
|
17779
|
+
result += value;
|
|
17780
|
+
result += span.literal.text;
|
|
17781
|
+
}
|
|
17782
|
+
return result;
|
|
17783
|
+
}
|
|
17784
|
+
return evaluate;
|
|
17785
|
+
}
|
|
17700
17786
|
|
|
17701
17787
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17702
17788
|
function createBaseNodeFactory() {
|
|
@@ -42598,13 +42684,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42598
42684
|
}
|
|
42599
42685
|
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
42600
42686
|
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
42601
|
-
|
|
42687
|
+
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
42688
|
+
if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
|
|
42602
42689
|
return maybeNonRelative;
|
|
42603
42690
|
}
|
|
42604
42691
|
return relativePath;
|
|
42605
42692
|
}
|
|
42606
42693
|
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
42607
42694
|
}
|
|
42695
|
+
function packageJsonPathsAreEqual(a, b, ignoreCase) {
|
|
42696
|
+
if (a === b)
|
|
42697
|
+
return true;
|
|
42698
|
+
if (a === void 0 || b === void 0)
|
|
42699
|
+
return false;
|
|
42700
|
+
return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
|
|
42701
|
+
}
|
|
42608
42702
|
function countPathComponents(path) {
|
|
42609
42703
|
let count = 0;
|
|
42610
42704
|
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
|
|
@@ -43370,6 +43464,10 @@ function createTypeChecker(host) {
|
|
|
43370
43464
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
43371
43465
|
var emitResolver = createResolver();
|
|
43372
43466
|
var nodeBuilder = createNodeBuilder();
|
|
43467
|
+
var evaluate = createEvaluator({
|
|
43468
|
+
evaluateElementAccessExpression,
|
|
43469
|
+
evaluateEntityNameExpression
|
|
43470
|
+
});
|
|
43373
43471
|
var globals = createSymbolTable();
|
|
43374
43472
|
var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
|
|
43375
43473
|
undefinedSymbol.declarations = [];
|
|
@@ -47868,17 +47966,8 @@ function createTypeChecker(host) {
|
|
|
47868
47966
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
47869
47967
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
47870
47968
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
47871
|
-
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
47872
|
-
|
|
47873
|
-
type,
|
|
47874
|
-
symbol,
|
|
47875
|
-
enclosingDeclaration,
|
|
47876
|
-
/*includePrivateSymbol*/
|
|
47877
|
-
void 0,
|
|
47878
|
-
/*bundled*/
|
|
47879
|
-
void 0,
|
|
47880
|
-
addUndefined
|
|
47881
|
-
)),
|
|
47969
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
|
|
47970
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
47882
47971
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47883
47972
|
indexInfo,
|
|
47884
47973
|
context,
|
|
@@ -47897,7 +47986,7 @@ function createTypeChecker(host) {
|
|
|
47897
47986
|
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
47898
47987
|
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
47899
47988
|
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
47900
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker
|
|
47989
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
47901
47990
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
47902
47991
|
};
|
|
47903
47992
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
@@ -47915,12 +48004,12 @@ function createTypeChecker(host) {
|
|
|
47915
48004
|
}
|
|
47916
48005
|
return typeToTypeNodeHelper(type, context);
|
|
47917
48006
|
}
|
|
47918
|
-
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined
|
|
48007
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
47919
48008
|
const originalType = type;
|
|
47920
48009
|
if (addUndefined) {
|
|
47921
48010
|
type = getOptionalType(type);
|
|
47922
48011
|
}
|
|
47923
|
-
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2
|
|
48012
|
+
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
47924
48013
|
if (clone) {
|
|
47925
48014
|
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
47926
48015
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
@@ -47928,16 +48017,16 @@ function createTypeChecker(host) {
|
|
|
47928
48017
|
return clone;
|
|
47929
48018
|
}
|
|
47930
48019
|
if (addUndefined && originalType !== type) {
|
|
47931
|
-
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2
|
|
48020
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2);
|
|
47932
48021
|
if (cloneMissingUndefined) {
|
|
47933
48022
|
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
47934
48023
|
}
|
|
47935
48024
|
}
|
|
47936
48025
|
return void 0;
|
|
47937
48026
|
}
|
|
47938
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration,
|
|
48027
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
|
|
47939
48028
|
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
47940
|
-
const result = tryReuseExistingTypeNodeHelper(context, existing
|
|
48029
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
47941
48030
|
if (result) {
|
|
47942
48031
|
return result;
|
|
47943
48032
|
}
|
|
@@ -47972,7 +48061,8 @@ function createTypeChecker(host) {
|
|
|
47972
48061
|
symbolDepth: void 0,
|
|
47973
48062
|
inferTypeParameters: void 0,
|
|
47974
48063
|
approximateLength: 0,
|
|
47975
|
-
trackedSymbols: void 0
|
|
48064
|
+
trackedSymbols: void 0,
|
|
48065
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
47976
48066
|
};
|
|
47977
48067
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
47978
48068
|
const resultingNode = cb(context);
|
|
@@ -48540,7 +48630,7 @@ function createTypeChecker(host) {
|
|
|
48540
48630
|
}
|
|
48541
48631
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
48542
48632
|
if (some(abstractSignatures)) {
|
|
48543
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
48633
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
48544
48634
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
48545
48635
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
48546
48636
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -48963,9 +49053,8 @@ function createTypeChecker(host) {
|
|
|
48963
49053
|
}
|
|
48964
49054
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
48965
49055
|
var _a;
|
|
48966
|
-
const
|
|
48967
|
-
|
|
48968
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49056
|
+
const flags = context.flags;
|
|
49057
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
48969
49058
|
context.approximateLength += 3;
|
|
48970
49059
|
let typeParameters;
|
|
48971
49060
|
let typeArguments;
|
|
@@ -49041,27 +49130,17 @@ function createTypeChecker(host) {
|
|
|
49041
49130
|
);
|
|
49042
49131
|
}
|
|
49043
49132
|
}
|
|
49044
|
-
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor
|
|
49133
|
+
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
|
|
49045
49134
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
49046
49135
|
if (thisParameter) {
|
|
49047
49136
|
parameters.unshift(thisParameter);
|
|
49048
49137
|
}
|
|
49049
|
-
|
|
49050
|
-
const
|
|
49051
|
-
if (typePredicate) {
|
|
49052
|
-
returnTypeNode = typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49053
|
-
} else {
|
|
49054
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
49055
|
-
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49056
|
-
returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
49057
|
-
} else if (!suppressAny) {
|
|
49058
|
-
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49059
|
-
}
|
|
49060
|
-
}
|
|
49138
|
+
context.flags = flags;
|
|
49139
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
49061
49140
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
49062
49141
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
49063
|
-
const
|
|
49064
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
49142
|
+
const flags2 = modifiersToFlags(modifiers);
|
|
49143
|
+
modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
|
|
49065
49144
|
}
|
|
49066
49145
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
49067
49146
|
modifiers,
|
|
@@ -49190,11 +49269,11 @@ function createTypeChecker(host) {
|
|
|
49190
49269
|
return getDeclarationOfKind(parameterSymbol, 341 /* JSDocParameterTag */);
|
|
49191
49270
|
}
|
|
49192
49271
|
}
|
|
49193
|
-
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags
|
|
49272
|
+
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
49194
49273
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49195
49274
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49196
49275
|
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
49197
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration,
|
|
49276
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
49198
49277
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49199
49278
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49200
49279
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -49763,7 +49842,7 @@ function createTypeChecker(host) {
|
|
|
49763
49842
|
return initial;
|
|
49764
49843
|
}
|
|
49765
49844
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
49766
|
-
return symbol.declarations && find(symbol.declarations, (s) => !!
|
|
49845
|
+
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
49767
49846
|
}
|
|
49768
49847
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
49769
49848
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
@@ -49774,13 +49853,13 @@ function createTypeChecker(host) {
|
|
|
49774
49853
|
}
|
|
49775
49854
|
return enclosingDeclaration;
|
|
49776
49855
|
}
|
|
49777
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration,
|
|
49856
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
|
|
49778
49857
|
var _a;
|
|
49779
49858
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49780
49859
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49781
49860
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49782
|
-
const existing =
|
|
49783
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined
|
|
49861
|
+
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49862
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
49784
49863
|
if (result2) {
|
|
49785
49864
|
return result2;
|
|
49786
49865
|
}
|
|
@@ -49805,22 +49884,43 @@ function createTypeChecker(host) {
|
|
|
49805
49884
|
}
|
|
49806
49885
|
return false;
|
|
49807
49886
|
}
|
|
49808
|
-
function serializeReturnTypeForSignature(context,
|
|
49887
|
+
function serializeReturnTypeForSignature(context, signature) {
|
|
49888
|
+
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
49889
|
+
const flags = context.flags;
|
|
49890
|
+
if (suppressAny)
|
|
49891
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49892
|
+
let returnTypeNode;
|
|
49893
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
49894
|
+
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49895
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
49896
|
+
} else if (!suppressAny) {
|
|
49897
|
+
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49898
|
+
}
|
|
49899
|
+
context.flags = flags;
|
|
49900
|
+
return returnTypeNode;
|
|
49901
|
+
}
|
|
49902
|
+
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
49903
|
+
const typePredicate = getTypePredicateOfSignature(signature);
|
|
49904
|
+
const type = getReturnTypeOfSignature(signature);
|
|
49809
49905
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
49810
|
-
const annotation = signature.declaration &&
|
|
49906
|
+
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
49811
49907
|
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
49812
49908
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49813
49909
|
const annotated = getTypeFromTypeNode(annotation);
|
|
49814
49910
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
49815
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration,
|
|
49911
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
49816
49912
|
if (result) {
|
|
49817
49913
|
return result;
|
|
49818
49914
|
}
|
|
49819
49915
|
}
|
|
49820
49916
|
}
|
|
49821
|
-
|
|
49917
|
+
if (typePredicate) {
|
|
49918
|
+
return typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49919
|
+
}
|
|
49920
|
+
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
49921
|
+
return expressionOrTypeToTypeNode(context, expr, type);
|
|
49822
49922
|
}
|
|
49823
|
-
function trackExistingEntityName(node, context
|
|
49923
|
+
function trackExistingEntityName(node, context) {
|
|
49824
49924
|
let introducesError = false;
|
|
49825
49925
|
const leftmost = getFirstIdentifier(node);
|
|
49826
49926
|
if (isInJSFile(node) && (isExportsIdentifier(leftmost) || isModuleExportsAccessExpression(leftmost.parent) || isQualifiedName(leftmost.parent) && isModuleIdentifier(leftmost.parent.left) && isExportsIdentifier(leftmost.parent.right))) {
|
|
@@ -49849,23 +49949,21 @@ function createTypeChecker(host) {
|
|
|
49849
49949
|
}
|
|
49850
49950
|
} else {
|
|
49851
49951
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
49852
|
-
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
49853
49952
|
}
|
|
49854
49953
|
if (isIdentifier(node)) {
|
|
49855
49954
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
49856
49955
|
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
|
|
49857
49956
|
name.symbol = sym;
|
|
49858
|
-
return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
49957
|
+
return { introducesError, node: setTextRange(setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */), node) };
|
|
49859
49958
|
}
|
|
49860
49959
|
}
|
|
49861
49960
|
return { introducesError, node };
|
|
49862
49961
|
}
|
|
49863
|
-
function tryReuseExistingTypeNodeHelper(context, existing
|
|
49962
|
+
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
49864
49963
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49865
49964
|
cancellationToken.throwIfCancellationRequested();
|
|
49866
49965
|
}
|
|
49867
49966
|
let hadError = false;
|
|
49868
|
-
const file = getSourceFileOfNode(existing);
|
|
49869
49967
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
49870
49968
|
if (hadError) {
|
|
49871
49969
|
return void 0;
|
|
@@ -49984,40 +50082,43 @@ function createTypeChecker(host) {
|
|
|
49984
50082
|
node.isTypeOf
|
|
49985
50083
|
);
|
|
49986
50084
|
}
|
|
49987
|
-
if (
|
|
49988
|
-
|
|
49989
|
-
return factory.updateParameterDeclaration(
|
|
49990
|
-
node,
|
|
49991
|
-
/*modifiers*/
|
|
49992
|
-
void 0,
|
|
49993
|
-
node.dotDotDotToken,
|
|
49994
|
-
visitEachChild(
|
|
49995
|
-
node.name,
|
|
49996
|
-
visitExistingNodeTreeSymbols,
|
|
49997
|
-
/*context*/
|
|
49998
|
-
void 0
|
|
49999
|
-
),
|
|
50000
|
-
node.questionToken,
|
|
50001
|
-
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
50002
|
-
/*initializer*/
|
|
50003
|
-
void 0
|
|
50004
|
-
);
|
|
50005
|
-
}
|
|
50085
|
+
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
50086
|
+
return void 0;
|
|
50006
50087
|
}
|
|
50007
|
-
if (isPropertySignature(node)) {
|
|
50008
|
-
|
|
50009
|
-
|
|
50088
|
+
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
50089
|
+
let visited = visitEachChild(
|
|
50090
|
+
node,
|
|
50091
|
+
visitExistingNodeTreeSymbols,
|
|
50092
|
+
/*context*/
|
|
50093
|
+
void 0
|
|
50094
|
+
);
|
|
50095
|
+
if (visited === node) {
|
|
50096
|
+
visited = setTextRange(factory.cloneNode(node), node);
|
|
50097
|
+
}
|
|
50098
|
+
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50099
|
+
if (isParameter(node)) {
|
|
50100
|
+
visited.modifiers = void 0;
|
|
50010
50101
|
}
|
|
50102
|
+
return visited;
|
|
50011
50103
|
}
|
|
50012
50104
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
50013
|
-
const { introducesError, node: result } = trackExistingEntityName(node, context
|
|
50105
|
+
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
50014
50106
|
hadError = hadError || introducesError;
|
|
50015
50107
|
if (result !== node) {
|
|
50016
50108
|
return result;
|
|
50017
50109
|
}
|
|
50018
50110
|
}
|
|
50019
|
-
if (
|
|
50020
|
-
|
|
50111
|
+
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
50112
|
+
const visited = visitEachChild(
|
|
50113
|
+
node,
|
|
50114
|
+
visitExistingNodeTreeSymbols,
|
|
50115
|
+
/*context*/
|
|
50116
|
+
void 0
|
|
50117
|
+
);
|
|
50118
|
+
const clone = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
|
|
50119
|
+
const flags = getEmitFlags(clone);
|
|
50120
|
+
setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
50121
|
+
return clone;
|
|
50021
50122
|
}
|
|
50022
50123
|
return visitEachChild(
|
|
50023
50124
|
node,
|
|
@@ -50032,7 +50133,7 @@ function createTypeChecker(host) {
|
|
|
50032
50133
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
50033
50134
|
}
|
|
50034
50135
|
function rewriteModuleSpecifier(parent, lit) {
|
|
50035
|
-
if (bundled) {
|
|
50136
|
+
if (context.bundled) {
|
|
50036
50137
|
if (context.tracker && context.tracker.moduleResolverHost) {
|
|
50037
50138
|
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
50038
50139
|
if (targetFile) {
|
|
@@ -50051,7 +50152,7 @@ function createTypeChecker(host) {
|
|
|
50051
50152
|
}
|
|
50052
50153
|
}
|
|
50053
50154
|
}
|
|
50054
|
-
function symbolTableToDeclarationStatements(symbolTable, context
|
|
50155
|
+
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
50055
50156
|
var _a;
|
|
50056
50157
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
50057
50158
|
factory.createPropertyDeclaration,
|
|
@@ -50110,7 +50211,7 @@ function createTypeChecker(host) {
|
|
|
50110
50211
|
const baseName = unescapeLeadingUnderscores(name);
|
|
50111
50212
|
void getInternalSymbolName(symbol, baseName);
|
|
50112
50213
|
});
|
|
50113
|
-
let addingDeclare = !bundled;
|
|
50214
|
+
let addingDeclare = !context.bundled;
|
|
50114
50215
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
50115
50216
|
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
50116
50217
|
symbolTable = createSymbolTable();
|
|
@@ -50391,7 +50492,7 @@ function createTypeChecker(host) {
|
|
|
50391
50492
|
name,
|
|
50392
50493
|
/*exclamationToken*/
|
|
50393
50494
|
void 0,
|
|
50394
|
-
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration
|
|
50495
|
+
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
|
|
50395
50496
|
)
|
|
50396
50497
|
], flags)
|
|
50397
50498
|
),
|
|
@@ -50533,9 +50634,7 @@ function createTypeChecker(host) {
|
|
|
50533
50634
|
jsdocAliasDecl.typeExpression.type,
|
|
50534
50635
|
aliasType,
|
|
50535
50636
|
/*host*/
|
|
50536
|
-
void 0
|
|
50537
|
-
includePrivateSymbol,
|
|
50538
|
-
bundled
|
|
50637
|
+
void 0
|
|
50539
50638
|
) || typeToTypeNodeHelper(aliasType, context);
|
|
50540
50639
|
addResult(
|
|
50541
50640
|
setSyntheticLeadingComments(
|
|
@@ -50665,7 +50764,7 @@ function createTypeChecker(host) {
|
|
|
50665
50764
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
50666
50765
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50667
50766
|
for (const sig of signatures) {
|
|
50668
|
-
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName)
|
|
50767
|
+
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
50669
50768
|
addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
50670
50769
|
}
|
|
50671
50770
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
@@ -50759,7 +50858,7 @@ function createTypeChecker(host) {
|
|
|
50759
50858
|
);
|
|
50760
50859
|
}
|
|
50761
50860
|
let introducesError;
|
|
50762
|
-
({ introducesError, node: expr } = trackExistingEntityName(expr, context
|
|
50861
|
+
({ introducesError, node: expr } = trackExistingEntityName(expr, context));
|
|
50763
50862
|
if (introducesError) {
|
|
50764
50863
|
return cleanup(
|
|
50765
50864
|
/*result*/
|
|
@@ -50769,15 +50868,7 @@ function createTypeChecker(host) {
|
|
|
50769
50868
|
}
|
|
50770
50869
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50771
50870
|
expr,
|
|
50772
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
50773
|
-
context,
|
|
50774
|
-
a,
|
|
50775
|
-
getTypeFromTypeNode(a),
|
|
50776
|
-
/*host*/
|
|
50777
|
-
void 0,
|
|
50778
|
-
includePrivateSymbol,
|
|
50779
|
-
bundled
|
|
50780
|
-
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50871
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50781
50872
|
));
|
|
50782
50873
|
function cleanup(result2) {
|
|
50783
50874
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -51002,7 +51093,7 @@ function createTypeChecker(host) {
|
|
|
51002
51093
|
break;
|
|
51003
51094
|
case 273 /* ImportClause */: {
|
|
51004
51095
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51005
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51096
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51006
51097
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
51007
51098
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
51008
51099
|
addResult(
|
|
@@ -51024,7 +51115,7 @@ function createTypeChecker(host) {
|
|
|
51024
51115
|
}
|
|
51025
51116
|
case 274 /* NamespaceImport */: {
|
|
51026
51117
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51027
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51118
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51028
51119
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
51029
51120
|
addResult(
|
|
51030
51121
|
factory.createImportDeclaration(
|
|
@@ -51058,7 +51149,7 @@ function createTypeChecker(host) {
|
|
|
51058
51149
|
break;
|
|
51059
51150
|
case 276 /* ImportSpecifier */: {
|
|
51060
51151
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51061
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51152
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51062
51153
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
51063
51154
|
addResult(
|
|
51064
51155
|
factory.createImportDeclaration(
|
|
@@ -51212,7 +51303,7 @@ function createTypeChecker(host) {
|
|
|
51212
51303
|
varName,
|
|
51213
51304
|
/*exclamationToken*/
|
|
51214
51305
|
void 0,
|
|
51215
|
-
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration
|
|
51306
|
+
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
|
|
51216
51307
|
)
|
|
51217
51308
|
], flags)
|
|
51218
51309
|
);
|
|
@@ -51296,7 +51387,7 @@ function createTypeChecker(host) {
|
|
|
51296
51387
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
51297
51388
|
/*questionToken*/
|
|
51298
51389
|
void 0,
|
|
51299
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51390
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
|
|
51300
51391
|
)],
|
|
51301
51392
|
/*body*/
|
|
51302
51393
|
void 0
|
|
@@ -51311,7 +51402,7 @@ function createTypeChecker(host) {
|
|
|
51311
51402
|
factory.createModifiersFromModifierFlags(flag),
|
|
51312
51403
|
name,
|
|
51313
51404
|
[],
|
|
51314
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51405
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51315
51406
|
/*body*/
|
|
51316
51407
|
void 0
|
|
51317
51408
|
),
|
|
@@ -51325,7 +51416,7 @@ function createTypeChecker(host) {
|
|
|
51325
51416
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51326
51417
|
name,
|
|
51327
51418
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
51328
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration
|
|
51419
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51329
51420
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
51330
51421
|
// interface members can't have initializers, however class members _can_
|
|
51331
51422
|
/*initializer*/
|
|
@@ -54697,11 +54788,15 @@ function createTypeChecker(host) {
|
|
|
54697
54788
|
const modifiers = getMappedTypeModifiers(type);
|
|
54698
54789
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
54699
54790
|
}
|
|
54700
|
-
function getModifiersTypeOptionality(type) {
|
|
54701
|
-
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
54702
|
-
}
|
|
54703
54791
|
function getCombinedMappedTypeOptionality(type) {
|
|
54704
|
-
|
|
54792
|
+
if (getObjectFlags(type) & 32 /* Mapped */) {
|
|
54793
|
+
return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
54794
|
+
}
|
|
54795
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
54796
|
+
const optionality = getCombinedMappedTypeOptionality(type.types[0]);
|
|
54797
|
+
return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
|
|
54798
|
+
}
|
|
54799
|
+
return 0;
|
|
54705
54800
|
}
|
|
54706
54801
|
function isPartialMappedType(type) {
|
|
54707
54802
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -55978,6 +56073,12 @@ function createTypeChecker(host) {
|
|
|
55978
56073
|
isInJSFile(signature.declaration)
|
|
55979
56074
|
);
|
|
55980
56075
|
}
|
|
56076
|
+
function getImplementationSignature(signature) {
|
|
56077
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
56078
|
+
}
|
|
56079
|
+
function createImplementationSignature(signature) {
|
|
56080
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
56081
|
+
}
|
|
55981
56082
|
function getBaseSignature(signature) {
|
|
55982
56083
|
const typeParameters = signature.typeParameters;
|
|
55983
56084
|
if (typeParameters) {
|
|
@@ -56000,12 +56101,22 @@ function createTypeChecker(host) {
|
|
|
56000
56101
|
}
|
|
56001
56102
|
return signature;
|
|
56002
56103
|
}
|
|
56003
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
56104
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
56004
56105
|
var _a;
|
|
56005
56106
|
if (!signature.isolatedSignatureType) {
|
|
56006
56107
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
56007
56108
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
56008
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
56109
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
56110
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56111
|
+
type.symbol.declarations = [signature.declaration];
|
|
56112
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
56113
|
+
}
|
|
56114
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
56115
|
+
signature.declaration,
|
|
56116
|
+
/*includeThisTypes*/
|
|
56117
|
+
true
|
|
56118
|
+
));
|
|
56119
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
56009
56120
|
type.members = emptySymbols;
|
|
56010
56121
|
type.properties = emptyArray;
|
|
56011
56122
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -58494,13 +58605,18 @@ function createTypeChecker(host) {
|
|
|
58494
58605
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
58495
58606
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
58496
58607
|
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
58608
|
+
const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
|
|
58497
58609
|
return addOptionality(
|
|
58498
58610
|
instantiatedTemplateType,
|
|
58499
58611
|
/*isProperty*/
|
|
58500
58612
|
true,
|
|
58501
|
-
|
|
58613
|
+
isOptional
|
|
58502
58614
|
);
|
|
58503
58615
|
}
|
|
58616
|
+
function couldAccessOptionalProperty(objectType, indexType) {
|
|
58617
|
+
const indexConstraint = getBaseConstraintOfType(indexType);
|
|
58618
|
+
return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
|
|
58619
|
+
}
|
|
58504
58620
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
58505
58621
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
58506
58622
|
}
|
|
@@ -59411,7 +59527,7 @@ function createTypeChecker(host) {
|
|
|
59411
59527
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
59412
59528
|
const links = getNodeLinks(declaration);
|
|
59413
59529
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
59414
|
-
let typeParameters = links.outerTypeParameters;
|
|
59530
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
59415
59531
|
if (!typeParameters) {
|
|
59416
59532
|
let outerTypeParameters = getOuterTypeParameters(
|
|
59417
59533
|
declaration,
|
|
@@ -59591,6 +59707,9 @@ function createTypeChecker(host) {
|
|
|
59591
59707
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
59592
59708
|
result.node = type.node;
|
|
59593
59709
|
}
|
|
59710
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
59711
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
59712
|
+
}
|
|
59594
59713
|
result.target = type;
|
|
59595
59714
|
result.mapper = mapper;
|
|
59596
59715
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -64222,7 +64341,7 @@ function createTypeChecker(host) {
|
|
|
64222
64341
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
64223
64342
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
64224
64343
|
}
|
|
64225
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64344
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64226
64345
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
64227
64346
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
64228
64347
|
}
|
|
@@ -64506,6 +64625,9 @@ function createTypeChecker(host) {
|
|
|
64506
64625
|
pos = p;
|
|
64507
64626
|
}
|
|
64508
64627
|
}
|
|
64628
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
64629
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
64630
|
+
}
|
|
64509
64631
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
64510
64632
|
let bivariant = false;
|
|
64511
64633
|
let propagationType;
|
|
@@ -64591,6 +64713,9 @@ function createTypeChecker(host) {
|
|
|
64591
64713
|
inference.priority = priority;
|
|
64592
64714
|
}
|
|
64593
64715
|
if (priority === inference.priority) {
|
|
64716
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
64717
|
+
return;
|
|
64718
|
+
}
|
|
64594
64719
|
if (contravariant && !bivariant) {
|
|
64595
64720
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
64596
64721
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -71529,7 +71654,7 @@ function createTypeChecker(host) {
|
|
|
71529
71654
|
argument = skipParentheses(argument);
|
|
71530
71655
|
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
71531
71656
|
}
|
|
71532
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
71657
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
|
71533
71658
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
71534
71659
|
if (isJsxOpeningLikeElement(node)) {
|
|
71535
71660
|
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
|
@@ -71563,7 +71688,8 @@ function createTypeChecker(host) {
|
|
|
71563
71688
|
void 0,
|
|
71564
71689
|
checkMode
|
|
71565
71690
|
);
|
|
71566
|
-
const
|
|
71691
|
+
const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71692
|
+
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
|
71567
71693
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71568
71694
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71569
71695
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -71975,7 +72101,9 @@ function createTypeChecker(host) {
|
|
|
71975
72101
|
0 /* Normal */,
|
|
71976
72102
|
/*reportErrors*/
|
|
71977
72103
|
true,
|
|
71978
|
-
() => chain
|
|
72104
|
+
() => chain,
|
|
72105
|
+
/*inferenceContext*/
|
|
72106
|
+
void 0
|
|
71979
72107
|
);
|
|
71980
72108
|
if (diags) {
|
|
71981
72109
|
for (const d of diags) {
|
|
@@ -72011,7 +72139,9 @@ function createTypeChecker(host) {
|
|
|
72011
72139
|
0 /* Normal */,
|
|
72012
72140
|
/*reportErrors*/
|
|
72013
72141
|
true,
|
|
72014
|
-
chain2
|
|
72142
|
+
chain2,
|
|
72143
|
+
/*inferenceContext*/
|
|
72144
|
+
void 0
|
|
72015
72145
|
);
|
|
72016
72146
|
if (diags2) {
|
|
72017
72147
|
if (diags2.length <= min2) {
|
|
@@ -72102,6 +72232,8 @@ function createTypeChecker(host) {
|
|
|
72102
72232
|
/*reportErrors*/
|
|
72103
72233
|
false,
|
|
72104
72234
|
/*containingMessageChain*/
|
|
72235
|
+
void 0,
|
|
72236
|
+
/*inferenceContext*/
|
|
72105
72237
|
void 0
|
|
72106
72238
|
)) {
|
|
72107
72239
|
candidatesForArgumentError = [candidate];
|
|
@@ -72110,13 +72242,16 @@ function createTypeChecker(host) {
|
|
|
72110
72242
|
return candidate;
|
|
72111
72243
|
}
|
|
72112
72244
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
72113
|
-
|
|
72245
|
+
let candidate = candidates2[candidateIndex];
|
|
72114
72246
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
72115
72247
|
continue;
|
|
72116
72248
|
}
|
|
72117
72249
|
let checkCandidate;
|
|
72118
72250
|
let inferenceContext;
|
|
72119
72251
|
if (candidate.typeParameters) {
|
|
72252
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
72253
|
+
candidate = getImplementationSignature(candidate);
|
|
72254
|
+
}
|
|
72120
72255
|
let typeArgumentTypes;
|
|
72121
72256
|
if (some(typeArguments)) {
|
|
72122
72257
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -72136,7 +72271,7 @@ function createTypeChecker(host) {
|
|
|
72136
72271
|
/*flags*/
|
|
72137
72272
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72138
72273
|
);
|
|
72139
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72274
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
72140
72275
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
72141
72276
|
}
|
|
72142
72277
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -72156,7 +72291,8 @@ function createTypeChecker(host) {
|
|
|
72156
72291
|
/*reportErrors*/
|
|
72157
72292
|
false,
|
|
72158
72293
|
/*containingMessageChain*/
|
|
72159
|
-
void 0
|
|
72294
|
+
void 0,
|
|
72295
|
+
inferenceContext
|
|
72160
72296
|
)) {
|
|
72161
72297
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
72162
72298
|
continue;
|
|
@@ -72164,7 +72300,7 @@ function createTypeChecker(host) {
|
|
|
72164
72300
|
if (argCheckMode) {
|
|
72165
72301
|
argCheckMode = 0 /* Normal */;
|
|
72166
72302
|
if (inferenceContext) {
|
|
72167
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72303
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
72168
72304
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72169
72305
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72170
72306
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -72180,7 +72316,8 @@ function createTypeChecker(host) {
|
|
|
72180
72316
|
/*reportErrors*/
|
|
72181
72317
|
false,
|
|
72182
72318
|
/*containingMessageChain*/
|
|
72183
|
-
void 0
|
|
72319
|
+
void 0,
|
|
72320
|
+
inferenceContext
|
|
72184
72321
|
)) {
|
|
72185
72322
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
72186
72323
|
continue;
|
|
@@ -75720,7 +75857,7 @@ function createTypeChecker(host) {
|
|
|
75720
75857
|
) || unknownType, isTemplateLiteralContextualType)) {
|
|
75721
75858
|
return getTemplateLiteralType(texts, types);
|
|
75722
75859
|
}
|
|
75723
|
-
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ &&
|
|
75860
|
+
const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
|
|
75724
75861
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
75725
75862
|
}
|
|
75726
75863
|
function isTemplateLiteralContextualType(type) {
|
|
@@ -75934,7 +76071,7 @@ function createTypeChecker(host) {
|
|
|
75934
76071
|
}
|
|
75935
76072
|
}
|
|
75936
76073
|
}
|
|
75937
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
76074
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
75938
76075
|
}
|
|
75939
76076
|
}
|
|
75940
76077
|
}
|
|
@@ -76109,7 +76246,8 @@ function createTypeChecker(host) {
|
|
|
76109
76246
|
if (getIsolatedModules(compilerOptions)) {
|
|
76110
76247
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76111
76248
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76112
|
-
|
|
76249
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
|
|
76250
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
|
|
76113
76251
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76114
76252
|
}
|
|
76115
76253
|
}
|
|
@@ -80696,122 +80834,53 @@ function createTypeChecker(host) {
|
|
|
80696
80834
|
}
|
|
80697
80835
|
return false;
|
|
80698
80836
|
}
|
|
80699
|
-
function
|
|
80700
|
-
|
|
80701
|
-
|
|
80702
|
-
|
|
80703
|
-
|
|
80704
|
-
|
|
80705
|
-
|
|
80706
|
-
|
|
80707
|
-
|
|
80708
|
-
|
|
80709
|
-
|
|
80710
|
-
|
|
80711
|
-
|
|
80712
|
-
|
|
80713
|
-
|
|
80714
|
-
|
|
80715
|
-
|
|
80716
|
-
|
|
80717
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
80718
|
-
switch (expr.operatorToken.kind) {
|
|
80719
|
-
case 52 /* BarToken */:
|
|
80720
|
-
return left | right;
|
|
80721
|
-
case 51 /* AmpersandToken */:
|
|
80722
|
-
return left & right;
|
|
80723
|
-
case 49 /* GreaterThanGreaterThanToken */:
|
|
80724
|
-
return left >> right;
|
|
80725
|
-
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
80726
|
-
return left >>> right;
|
|
80727
|
-
case 48 /* LessThanLessThanToken */:
|
|
80728
|
-
return left << right;
|
|
80729
|
-
case 53 /* CaretToken */:
|
|
80730
|
-
return left ^ right;
|
|
80731
|
-
case 42 /* AsteriskToken */:
|
|
80732
|
-
return left * right;
|
|
80733
|
-
case 44 /* SlashToken */:
|
|
80734
|
-
return left / right;
|
|
80735
|
-
case 40 /* PlusToken */:
|
|
80736
|
-
return left + right;
|
|
80737
|
-
case 41 /* MinusToken */:
|
|
80738
|
-
return left - right;
|
|
80739
|
-
case 45 /* PercentToken */:
|
|
80740
|
-
return left % right;
|
|
80741
|
-
case 43 /* AsteriskAsteriskToken */:
|
|
80742
|
-
return left ** right;
|
|
80743
|
-
}
|
|
80744
|
-
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
80745
|
-
return "" + left + right;
|
|
80746
|
-
}
|
|
80747
|
-
break;
|
|
80748
|
-
case 11 /* StringLiteral */:
|
|
80749
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
80750
|
-
return expr.text;
|
|
80751
|
-
case 228 /* TemplateExpression */:
|
|
80752
|
-
return evaluateTemplateExpression(expr, location);
|
|
80753
|
-
case 9 /* NumericLiteral */:
|
|
80754
|
-
checkGrammarNumericLiteral(expr);
|
|
80755
|
-
return +expr.text;
|
|
80756
|
-
case 217 /* ParenthesizedExpression */:
|
|
80757
|
-
return evaluate(expr.expression, location);
|
|
80758
|
-
case 80 /* Identifier */: {
|
|
80759
|
-
const identifier = expr;
|
|
80760
|
-
if (isInfinityOrNaNString(identifier.escapedText) && resolveEntityName(
|
|
80761
|
-
identifier,
|
|
80762
|
-
111551 /* Value */,
|
|
80763
|
-
/*ignoreErrors*/
|
|
80764
|
-
true
|
|
80765
|
-
) === getGlobalSymbol(
|
|
80766
|
-
identifier.escapedText,
|
|
80767
|
-
111551 /* Value */,
|
|
80768
|
-
/*diagnostic*/
|
|
80769
|
-
void 0
|
|
80770
|
-
)) {
|
|
80771
|
-
return +identifier.escapedText;
|
|
80772
|
-
}
|
|
80837
|
+
function evaluateEntityNameExpression(expr, location) {
|
|
80838
|
+
const symbol = resolveEntityName(
|
|
80839
|
+
expr,
|
|
80840
|
+
111551 /* Value */,
|
|
80841
|
+
/*ignoreErrors*/
|
|
80842
|
+
true
|
|
80843
|
+
);
|
|
80844
|
+
if (!symbol)
|
|
80845
|
+
return void 0;
|
|
80846
|
+
if (expr.kind === 80 /* Identifier */) {
|
|
80847
|
+
const identifier = expr;
|
|
80848
|
+
if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
|
|
80849
|
+
identifier.escapedText,
|
|
80850
|
+
111551 /* Value */,
|
|
80851
|
+
/*diagnostic*/
|
|
80852
|
+
void 0
|
|
80853
|
+
)) {
|
|
80854
|
+
return +identifier.escapedText;
|
|
80773
80855
|
}
|
|
80774
|
-
|
|
80775
|
-
|
|
80776
|
-
|
|
80777
|
-
|
|
80778
|
-
|
|
80779
|
-
|
|
80780
|
-
|
|
80781
|
-
|
|
80782
|
-
|
|
80783
|
-
|
|
80784
|
-
|
|
80785
|
-
|
|
80786
|
-
|
|
80787
|
-
|
|
80788
|
-
|
|
80789
|
-
|
|
80790
|
-
|
|
80791
|
-
|
|
80792
|
-
|
|
80793
|
-
|
|
80794
|
-
|
|
80795
|
-
|
|
80796
|
-
const
|
|
80797
|
-
if (
|
|
80798
|
-
|
|
80799
|
-
root,
|
|
80800
|
-
111551 /* Value */,
|
|
80801
|
-
/*ignoreErrors*/
|
|
80802
|
-
true
|
|
80803
|
-
);
|
|
80804
|
-
if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
|
|
80805
|
-
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
80806
|
-
const member = rootSymbol.exports.get(name);
|
|
80807
|
-
if (member) {
|
|
80808
|
-
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
80809
|
-
}
|
|
80810
|
-
}
|
|
80856
|
+
}
|
|
80857
|
+
if (symbol.flags & 8 /* EnumMember */) {
|
|
80858
|
+
return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
|
|
80859
|
+
}
|
|
80860
|
+
if (isConstantVariable(symbol)) {
|
|
80861
|
+
const declaration = symbol.valueDeclaration;
|
|
80862
|
+
if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
80863
|
+
return evaluate(declaration.initializer, declaration);
|
|
80864
|
+
}
|
|
80865
|
+
}
|
|
80866
|
+
}
|
|
80867
|
+
function evaluateElementAccessExpression(expr, location) {
|
|
80868
|
+
const root = expr.expression;
|
|
80869
|
+
if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
|
|
80870
|
+
const rootSymbol = resolveEntityName(
|
|
80871
|
+
root,
|
|
80872
|
+
111551 /* Value */,
|
|
80873
|
+
/*ignoreErrors*/
|
|
80874
|
+
true
|
|
80875
|
+
);
|
|
80876
|
+
if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
|
|
80877
|
+
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
80878
|
+
const member = rootSymbol.exports.get(name);
|
|
80879
|
+
if (member) {
|
|
80880
|
+
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
80811
80881
|
}
|
|
80812
|
-
|
|
80882
|
+
}
|
|
80813
80883
|
}
|
|
80814
|
-
return void 0;
|
|
80815
80884
|
}
|
|
80816
80885
|
function evaluateEnumMember(expr, symbol, location) {
|
|
80817
80886
|
const declaration = symbol.valueDeclaration;
|
|
@@ -80825,18 +80894,6 @@ function createTypeChecker(host) {
|
|
|
80825
80894
|
}
|
|
80826
80895
|
return getEnumMemberValue(declaration);
|
|
80827
80896
|
}
|
|
80828
|
-
function evaluateTemplateExpression(expr, location) {
|
|
80829
|
-
let result = expr.head.text;
|
|
80830
|
-
for (const span of expr.templateSpans) {
|
|
80831
|
-
const value = evaluate(span.expression, location);
|
|
80832
|
-
if (value === void 0) {
|
|
80833
|
-
return void 0;
|
|
80834
|
-
}
|
|
80835
|
-
result += value;
|
|
80836
|
-
result += span.literal.text;
|
|
80837
|
-
}
|
|
80838
|
-
return result;
|
|
80839
|
-
}
|
|
80840
80897
|
function checkEnumDeclaration(node) {
|
|
80841
80898
|
addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
|
|
80842
80899
|
}
|
|
@@ -83103,9 +83160,23 @@ function createTypeChecker(host) {
|
|
|
83103
83160
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83104
83161
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
83105
83162
|
}
|
|
83163
|
+
function getAllAccessorDeclarationsForDeclaration(accessor) {
|
|
83164
|
+
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83165
|
+
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83166
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83167
|
+
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83168
|
+
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83169
|
+
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83170
|
+
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83171
|
+
return {
|
|
83172
|
+
firstAccessor,
|
|
83173
|
+
secondAccessor,
|
|
83174
|
+
setAccessor,
|
|
83175
|
+
getAccessor
|
|
83176
|
+
};
|
|
83177
|
+
}
|
|
83106
83178
|
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
83107
|
-
|
|
83108
|
-
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
|
|
83179
|
+
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarationsForDeclaration(declaration.parent).getAccessor) : void 0;
|
|
83109
83180
|
}
|
|
83110
83181
|
function getSingleReturnExpression(declaration) {
|
|
83111
83182
|
let candidateExpr;
|
|
@@ -83131,20 +83202,7 @@ function createTypeChecker(host) {
|
|
|
83131
83202
|
if (!signatureDeclaration) {
|
|
83132
83203
|
return factory.createToken(133 /* AnyKeyword */);
|
|
83133
83204
|
}
|
|
83134
|
-
|
|
83135
|
-
const typePredicate = getTypePredicateOfSignature(signature);
|
|
83136
|
-
if (typePredicate) {
|
|
83137
|
-
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83138
|
-
}
|
|
83139
|
-
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
83140
|
-
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
83141
|
-
getReturnTypeOfSignature(signature),
|
|
83142
|
-
/*addUndefined*/
|
|
83143
|
-
void 0,
|
|
83144
|
-
enclosingDeclaration,
|
|
83145
|
-
flags | 1024 /* MultilineObjectLiterals */,
|
|
83146
|
-
tracker
|
|
83147
|
-
);
|
|
83205
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83148
83206
|
}
|
|
83149
83207
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
83150
83208
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -83303,6 +83361,35 @@ function createTypeChecker(host) {
|
|
|
83303
83361
|
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
|
83304
83362
|
}
|
|
83305
83363
|
}
|
|
83364
|
+
function getNonlocalEffectiveTypeAnnotationNode(node) {
|
|
83365
|
+
const direct = getEffectiveTypeAnnotationNode(node);
|
|
83366
|
+
if (direct) {
|
|
83367
|
+
return direct;
|
|
83368
|
+
}
|
|
83369
|
+
if (node.kind === 169 /* Parameter */ && node.parent.kind === 178 /* SetAccessor */) {
|
|
83370
|
+
const other = getAllAccessorDeclarationsForDeclaration(node.parent).getAccessor;
|
|
83371
|
+
if (other) {
|
|
83372
|
+
return getEffectiveReturnTypeNode(other);
|
|
83373
|
+
}
|
|
83374
|
+
}
|
|
83375
|
+
return void 0;
|
|
83376
|
+
}
|
|
83377
|
+
function getNonlocalEffectiveReturnTypeAnnotationNode(node) {
|
|
83378
|
+
const direct = getEffectiveReturnTypeNode(node);
|
|
83379
|
+
if (direct) {
|
|
83380
|
+
return direct;
|
|
83381
|
+
}
|
|
83382
|
+
if (node.kind === 177 /* GetAccessor */) {
|
|
83383
|
+
const other = getAllAccessorDeclarationsForDeclaration(node).setAccessor;
|
|
83384
|
+
if (other) {
|
|
83385
|
+
const param = getSetAccessorValueParameter(other);
|
|
83386
|
+
if (param) {
|
|
83387
|
+
return getEffectiveTypeAnnotationNode(param);
|
|
83388
|
+
}
|
|
83389
|
+
}
|
|
83390
|
+
}
|
|
83391
|
+
return void 0;
|
|
83392
|
+
}
|
|
83306
83393
|
function createResolver() {
|
|
83307
83394
|
return {
|
|
83308
83395
|
getReferencedExportContainer,
|
|
@@ -83356,34 +83443,19 @@ function createTypeChecker(host) {
|
|
|
83356
83443
|
},
|
|
83357
83444
|
getJsxFactoryEntity,
|
|
83358
83445
|
getJsxFragmentFactoryEntity,
|
|
83359
|
-
getAllAccessorDeclarations(accessor) {
|
|
83360
|
-
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83361
|
-
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83362
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83363
|
-
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83364
|
-
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83365
|
-
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83366
|
-
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83367
|
-
return {
|
|
83368
|
-
firstAccessor,
|
|
83369
|
-
secondAccessor,
|
|
83370
|
-
setAccessor,
|
|
83371
|
-
getAccessor
|
|
83372
|
-
};
|
|
83373
|
-
},
|
|
83374
83446
|
isBindingCapturedByNode: (node, decl) => {
|
|
83375
83447
|
const parseNode = getParseTreeNode(node);
|
|
83376
83448
|
const parseDecl = getParseTreeNode(decl);
|
|
83377
83449
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
83378
83450
|
},
|
|
83379
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker
|
|
83451
|
+
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
83380
83452
|
const n = getParseTreeNode(node);
|
|
83381
83453
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
83382
83454
|
const sym = getSymbolOfDeclaration(node);
|
|
83383
83455
|
if (!sym) {
|
|
83384
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker
|
|
83456
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
83385
83457
|
}
|
|
83386
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker
|
|
83458
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
83387
83459
|
},
|
|
83388
83460
|
isImportRequiredByAugmentation
|
|
83389
83461
|
};
|
|
@@ -83725,7 +83797,7 @@ function createTypeChecker(host) {
|
|
|
83725
83797
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
|
|
83726
83798
|
}
|
|
83727
83799
|
} else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
|
|
83728
|
-
const accessors =
|
|
83800
|
+
const accessors = getAllAccessorDeclarationsForDeclaration(node);
|
|
83729
83801
|
if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
|
|
83730
83802
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
83731
83803
|
}
|
|
@@ -88916,7 +88988,7 @@ function transformTypeScript(context) {
|
|
|
88916
88988
|
if (typeSerializer) {
|
|
88917
88989
|
let decorators;
|
|
88918
88990
|
if (shouldAddTypeMetadata(node)) {
|
|
88919
|
-
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node));
|
|
88991
|
+
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container));
|
|
88920
88992
|
decorators = append(decorators, factory2.createDecorator(typeMetadata));
|
|
88921
88993
|
}
|
|
88922
88994
|
if (shouldAddParamTypesMetadata(node)) {
|
|
@@ -88943,7 +89015,7 @@ function transformTypeScript(context) {
|
|
|
88943
89015
|
/*type*/
|
|
88944
89016
|
void 0,
|
|
88945
89017
|
factory2.createToken(39 /* EqualsGreaterThanToken */),
|
|
88946
|
-
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
|
|
89018
|
+
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
|
|
88947
89019
|
));
|
|
88948
89020
|
properties = append(properties, typeProperty);
|
|
88949
89021
|
}
|
|
@@ -92380,7 +92452,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92380
92452
|
let currentNameScope;
|
|
92381
92453
|
return {
|
|
92382
92454
|
serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
|
|
92383
|
-
serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
|
|
92455
|
+
serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
|
|
92384
92456
|
serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
|
|
92385
92457
|
serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
|
|
92386
92458
|
};
|
|
@@ -92394,18 +92466,18 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92394
92466
|
currentNameScope = savedCurrentNameScope;
|
|
92395
92467
|
return result;
|
|
92396
92468
|
}
|
|
92397
|
-
function getAccessorTypeNode(node) {
|
|
92398
|
-
const accessors =
|
|
92469
|
+
function getAccessorTypeNode(node, container) {
|
|
92470
|
+
const accessors = getAllAccessorDeclarations(container.members, node);
|
|
92399
92471
|
return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
|
|
92400
92472
|
}
|
|
92401
|
-
function serializeTypeOfNode(node) {
|
|
92473
|
+
function serializeTypeOfNode(node, container) {
|
|
92402
92474
|
switch (node.kind) {
|
|
92403
92475
|
case 172 /* PropertyDeclaration */:
|
|
92404
92476
|
case 169 /* Parameter */:
|
|
92405
92477
|
return serializeTypeNode(node.type);
|
|
92406
92478
|
case 178 /* SetAccessor */:
|
|
92407
92479
|
case 177 /* GetAccessor */:
|
|
92408
|
-
return serializeTypeNode(getAccessorTypeNode(node));
|
|
92480
|
+
return serializeTypeNode(getAccessorTypeNode(node, container));
|
|
92409
92481
|
case 263 /* ClassDeclaration */:
|
|
92410
92482
|
case 231 /* ClassExpression */:
|
|
92411
92483
|
case 174 /* MethodDeclaration */:
|
|
@@ -92428,7 +92500,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92428
92500
|
if (parameter.dotDotDotToken) {
|
|
92429
92501
|
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
|
92430
92502
|
} else {
|
|
92431
|
-
expressions.push(serializeTypeOfNode(parameter));
|
|
92503
|
+
expressions.push(serializeTypeOfNode(parameter, container));
|
|
92432
92504
|
}
|
|
92433
92505
|
}
|
|
92434
92506
|
}
|
|
@@ -108455,13 +108527,13 @@ function transformDeclarations(context) {
|
|
|
108455
108527
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108456
108528
|
}
|
|
108457
108529
|
}
|
|
108458
|
-
function transformDeclarationsForJS(sourceFile
|
|
108530
|
+
function transformDeclarationsForJS(sourceFile) {
|
|
108459
108531
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108460
108532
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
108461
108533
|
diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
|
|
108462
108534
|
errorNode: s.errorNode || sourceFile
|
|
108463
108535
|
};
|
|
108464
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker
|
|
108536
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108465
108537
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108466
108538
|
return result;
|
|
108467
108539
|
}
|
|
@@ -108492,11 +108564,7 @@ function transformDeclarations(context) {
|
|
|
108492
108564
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
108493
108565
|
resultHasExternalModuleIndicator = false;
|
|
108494
108566
|
needsDeclare = false;
|
|
108495
|
-
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(
|
|
108496
|
-
sourceFile,
|
|
108497
|
-
/*bundled*/
|
|
108498
|
-
true
|
|
108499
|
-
)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108567
|
+
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108500
108568
|
const newFile = factory2.updateSourceFile(
|
|
108501
108569
|
sourceFile,
|
|
108502
108570
|
[factory2.createModuleDeclaration(
|
|
@@ -108818,7 +108886,7 @@ function transformDeclarations(context) {
|
|
|
108818
108886
|
if (!isPrivate) {
|
|
108819
108887
|
const valueParameter = getSetAccessorValueParameter(input);
|
|
108820
108888
|
if (valueParameter) {
|
|
108821
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
108889
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
108822
108890
|
newValueParameter = ensureParameter(
|
|
108823
108891
|
valueParameter,
|
|
108824
108892
|
/*modifierMask*/
|
|
@@ -109104,7 +109172,7 @@ function transformDeclarations(context) {
|
|
|
109104
109172
|
void 0
|
|
109105
109173
|
);
|
|
109106
109174
|
}
|
|
109107
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
109175
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
109108
109176
|
return cleanup(factory2.updateGetAccessorDeclaration(
|
|
109109
109177
|
input,
|
|
109110
109178
|
ensureModifiers(input),
|
|
@@ -110952,7 +111020,6 @@ var notImplementedResolver = {
|
|
|
110952
111020
|
isLiteralConstDeclaration: notImplemented,
|
|
110953
111021
|
getJsxFactoryEntity: notImplemented,
|
|
110954
111022
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
110955
|
-
getAllAccessorDeclarations: notImplemented,
|
|
110956
111023
|
isBindingCapturedByNode: notImplemented,
|
|
110957
111024
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
110958
111025
|
isImportRequiredByAugmentation: notImplemented
|
|
@@ -117018,6 +117085,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117018
117085
|
getResolvedProjectReferenceByPath,
|
|
117019
117086
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
117020
117087
|
isSourceOfProjectReferenceRedirect,
|
|
117088
|
+
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
117021
117089
|
emitBuildInfo,
|
|
117022
117090
|
fileExists,
|
|
117023
117091
|
readFile,
|
|
@@ -121893,7 +121961,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121893
121961
|
impliedFormatPackageJsons.delete(newFile.resolvedPath);
|
|
121894
121962
|
});
|
|
121895
121963
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
121896
|
-
|
|
121964
|
+
const newFile = newProgram == null ? void 0 : newProgram.getSourceFileByPath(path);
|
|
121965
|
+
if (!newFile || newFile.resolvedPath !== path) {
|
|
121897
121966
|
existing.forEach((location) => fileWatchesOfAffectingLocations.get(location).files--);
|
|
121898
121967
|
impliedFormatPackageJsons.delete(path);
|
|
121899
121968
|
}
|