@typescript-deploys/pr-build 5.5.0-pr-57989-9 → 5.5.0-pr-58001-5
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/tsc.js +206 -234
- package/lib/typescript.js +247 -272
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240329`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -47966,17 +47966,7 @@ function createTypeChecker(host) {
|
|
|
47966
47966
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
47967
47967
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
47968
47968
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
47969
|
-
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
47970
|
-
context,
|
|
47971
|
-
type,
|
|
47972
|
-
symbol,
|
|
47973
|
-
enclosingDeclaration,
|
|
47974
|
-
/*includePrivateSymbol*/
|
|
47975
|
-
void 0,
|
|
47976
|
-
/*bundled*/
|
|
47977
|
-
void 0,
|
|
47978
|
-
addUndefined
|
|
47979
|
-
)),
|
|
47969
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
|
|
47980
47970
|
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
47981
47971
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47982
47972
|
indexInfo,
|
|
@@ -47996,7 +47986,7 @@ function createTypeChecker(host) {
|
|
|
47996
47986
|
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
47997
47987
|
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
47998
47988
|
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
47999
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker
|
|
47989
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
48000
47990
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
48001
47991
|
};
|
|
48002
47992
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
@@ -48014,12 +48004,12 @@ function createTypeChecker(host) {
|
|
|
48014
48004
|
}
|
|
48015
48005
|
return typeToTypeNodeHelper(type, context);
|
|
48016
48006
|
}
|
|
48017
|
-
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined
|
|
48007
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
48018
48008
|
const originalType = type;
|
|
48019
48009
|
if (addUndefined) {
|
|
48020
48010
|
type = getOptionalType(type);
|
|
48021
48011
|
}
|
|
48022
|
-
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2
|
|
48012
|
+
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
48023
48013
|
if (clone) {
|
|
48024
48014
|
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
48025
48015
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
@@ -48027,16 +48017,16 @@ function createTypeChecker(host) {
|
|
|
48027
48017
|
return clone;
|
|
48028
48018
|
}
|
|
48029
48019
|
if (addUndefined && originalType !== type) {
|
|
48030
|
-
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2
|
|
48020
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2);
|
|
48031
48021
|
if (cloneMissingUndefined) {
|
|
48032
48022
|
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
48033
48023
|
}
|
|
48034
48024
|
}
|
|
48035
48025
|
return void 0;
|
|
48036
48026
|
}
|
|
48037
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration,
|
|
48027
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
|
|
48038
48028
|
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
48039
|
-
const result = tryReuseExistingTypeNodeHelper(context, existing
|
|
48029
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
48040
48030
|
if (result) {
|
|
48041
48031
|
return result;
|
|
48042
48032
|
}
|
|
@@ -48071,7 +48061,8 @@ function createTypeChecker(host) {
|
|
|
48071
48061
|
symbolDepth: void 0,
|
|
48072
48062
|
inferTypeParameters: void 0,
|
|
48073
48063
|
approximateLength: 0,
|
|
48074
|
-
trackedSymbols: void 0
|
|
48064
|
+
trackedSymbols: void 0,
|
|
48065
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
48075
48066
|
};
|
|
48076
48067
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
48077
48068
|
const resultingNode = cb(context);
|
|
@@ -49139,13 +49130,13 @@ function createTypeChecker(host) {
|
|
|
49139
49130
|
);
|
|
49140
49131
|
}
|
|
49141
49132
|
}
|
|
49142
|
-
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 */));
|
|
49143
49134
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
49144
49135
|
if (thisParameter) {
|
|
49145
49136
|
parameters.unshift(thisParameter);
|
|
49146
49137
|
}
|
|
49147
49138
|
context.flags = flags;
|
|
49148
|
-
const returnTypeNode = serializeReturnTypeForSignature(context, signature
|
|
49139
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
49149
49140
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
49150
49141
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
49151
49142
|
const flags2 = modifiersToFlags(modifiers);
|
|
@@ -49278,11 +49269,11 @@ function createTypeChecker(host) {
|
|
|
49278
49269
|
return getDeclarationOfKind(parameterSymbol, 341 /* JSDocParameterTag */);
|
|
49279
49270
|
}
|
|
49280
49271
|
}
|
|
49281
|
-
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags
|
|
49272
|
+
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
49282
49273
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49283
49274
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49284
49275
|
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
49285
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration,
|
|
49276
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
49286
49277
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49287
49278
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49288
49279
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -49851,7 +49842,7 @@ function createTypeChecker(host) {
|
|
|
49851
49842
|
return initial;
|
|
49852
49843
|
}
|
|
49853
49844
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
49854
|
-
return symbol.declarations && find(symbol.declarations, (s) => !!
|
|
49845
|
+
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
49855
49846
|
}
|
|
49856
49847
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
49857
49848
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
@@ -49862,13 +49853,13 @@ function createTypeChecker(host) {
|
|
|
49862
49853
|
}
|
|
49863
49854
|
return enclosingDeclaration;
|
|
49864
49855
|
}
|
|
49865
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration,
|
|
49856
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
|
|
49866
49857
|
var _a;
|
|
49867
49858
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49868
49859
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49869
49860
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49870
|
-
const existing =
|
|
49871
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined
|
|
49861
|
+
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49862
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
49872
49863
|
if (result2) {
|
|
49873
49864
|
return result2;
|
|
49874
49865
|
}
|
|
@@ -49893,7 +49884,7 @@ function createTypeChecker(host) {
|
|
|
49893
49884
|
}
|
|
49894
49885
|
return false;
|
|
49895
49886
|
}
|
|
49896
|
-
function serializeReturnTypeForSignature(context, signature
|
|
49887
|
+
function serializeReturnTypeForSignature(context, signature) {
|
|
49897
49888
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
49898
49889
|
const flags = context.flags;
|
|
49899
49890
|
if (suppressAny)
|
|
@@ -49901,23 +49892,23 @@ function createTypeChecker(host) {
|
|
|
49901
49892
|
let returnTypeNode;
|
|
49902
49893
|
const returnType = getReturnTypeOfSignature(signature);
|
|
49903
49894
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49904
|
-
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature
|
|
49895
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
49905
49896
|
} else if (!suppressAny) {
|
|
49906
49897
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49907
49898
|
}
|
|
49908
49899
|
context.flags = flags;
|
|
49909
49900
|
return returnTypeNode;
|
|
49910
49901
|
}
|
|
49911
|
-
function serializeReturnTypeForSignatureWorker(context, signature
|
|
49902
|
+
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
49912
49903
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
49913
49904
|
const type = getReturnTypeOfSignature(signature);
|
|
49914
49905
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
49915
|
-
const annotation = signature.declaration &&
|
|
49906
|
+
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
49916
49907
|
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
49917
49908
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49918
49909
|
const annotated = getTypeFromTypeNode(annotation);
|
|
49919
49910
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
49920
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration,
|
|
49911
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
49921
49912
|
if (result) {
|
|
49922
49913
|
return result;
|
|
49923
49914
|
}
|
|
@@ -49929,7 +49920,7 @@ function createTypeChecker(host) {
|
|
|
49929
49920
|
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
49930
49921
|
return expressionOrTypeToTypeNode(context, expr, type);
|
|
49931
49922
|
}
|
|
49932
|
-
function trackExistingEntityName(node, context
|
|
49923
|
+
function trackExistingEntityName(node, context) {
|
|
49933
49924
|
let introducesError = false;
|
|
49934
49925
|
const leftmost = getFirstIdentifier(node);
|
|
49935
49926
|
if (isInJSFile(node) && (isExportsIdentifier(leftmost) || isModuleExportsAccessExpression(leftmost.parent) || isQualifiedName(leftmost.parent) && isModuleIdentifier(leftmost.parent.left) && isExportsIdentifier(leftmost.parent.right))) {
|
|
@@ -49958,7 +49949,6 @@ function createTypeChecker(host) {
|
|
|
49958
49949
|
}
|
|
49959
49950
|
} else {
|
|
49960
49951
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
49961
|
-
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
49962
49952
|
}
|
|
49963
49953
|
if (isIdentifier(node)) {
|
|
49964
49954
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
@@ -49969,7 +49959,7 @@ function createTypeChecker(host) {
|
|
|
49969
49959
|
}
|
|
49970
49960
|
return { introducesError, node };
|
|
49971
49961
|
}
|
|
49972
|
-
function tryReuseExistingTypeNodeHelper(context, existing
|
|
49962
|
+
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
49973
49963
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49974
49964
|
cancellationToken.throwIfCancellationRequested();
|
|
49975
49965
|
}
|
|
@@ -50112,7 +50102,7 @@ function createTypeChecker(host) {
|
|
|
50112
50102
|
return visited;
|
|
50113
50103
|
}
|
|
50114
50104
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
50115
|
-
const { introducesError, node: result } = trackExistingEntityName(node, context
|
|
50105
|
+
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
50116
50106
|
hadError = hadError || introducesError;
|
|
50117
50107
|
if (result !== node) {
|
|
50118
50108
|
return result;
|
|
@@ -50143,7 +50133,7 @@ function createTypeChecker(host) {
|
|
|
50143
50133
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
50144
50134
|
}
|
|
50145
50135
|
function rewriteModuleSpecifier(parent, lit) {
|
|
50146
|
-
if (bundled) {
|
|
50136
|
+
if (context.bundled) {
|
|
50147
50137
|
if (context.tracker && context.tracker.moduleResolverHost) {
|
|
50148
50138
|
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
50149
50139
|
if (targetFile) {
|
|
@@ -50162,7 +50152,7 @@ function createTypeChecker(host) {
|
|
|
50162
50152
|
}
|
|
50163
50153
|
}
|
|
50164
50154
|
}
|
|
50165
|
-
function symbolTableToDeclarationStatements(symbolTable, context
|
|
50155
|
+
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
50166
50156
|
var _a;
|
|
50167
50157
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
50168
50158
|
factory.createPropertyDeclaration,
|
|
@@ -50221,7 +50211,7 @@ function createTypeChecker(host) {
|
|
|
50221
50211
|
const baseName = unescapeLeadingUnderscores(name);
|
|
50222
50212
|
void getInternalSymbolName(symbol, baseName);
|
|
50223
50213
|
});
|
|
50224
|
-
let addingDeclare = !bundled;
|
|
50214
|
+
let addingDeclare = !context.bundled;
|
|
50225
50215
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
50226
50216
|
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
50227
50217
|
symbolTable = createSymbolTable();
|
|
@@ -50502,7 +50492,7 @@ function createTypeChecker(host) {
|
|
|
50502
50492
|
name,
|
|
50503
50493
|
/*exclamationToken*/
|
|
50504
50494
|
void 0,
|
|
50505
|
-
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration
|
|
50495
|
+
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
|
|
50506
50496
|
)
|
|
50507
50497
|
], flags)
|
|
50508
50498
|
),
|
|
@@ -50644,9 +50634,7 @@ function createTypeChecker(host) {
|
|
|
50644
50634
|
jsdocAliasDecl.typeExpression.type,
|
|
50645
50635
|
aliasType,
|
|
50646
50636
|
/*host*/
|
|
50647
|
-
void 0
|
|
50648
|
-
includePrivateSymbol,
|
|
50649
|
-
bundled
|
|
50637
|
+
void 0
|
|
50650
50638
|
) || typeToTypeNodeHelper(aliasType, context);
|
|
50651
50639
|
addResult(
|
|
50652
50640
|
setSyntheticLeadingComments(
|
|
@@ -50776,7 +50764,7 @@ function createTypeChecker(host) {
|
|
|
50776
50764
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
50777
50765
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50778
50766
|
for (const sig of signatures) {
|
|
50779
|
-
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName)
|
|
50767
|
+
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
50780
50768
|
addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
50781
50769
|
}
|
|
50782
50770
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
@@ -50870,7 +50858,7 @@ function createTypeChecker(host) {
|
|
|
50870
50858
|
);
|
|
50871
50859
|
}
|
|
50872
50860
|
let introducesError;
|
|
50873
|
-
({ introducesError, node: expr } = trackExistingEntityName(expr, context
|
|
50861
|
+
({ introducesError, node: expr } = trackExistingEntityName(expr, context));
|
|
50874
50862
|
if (introducesError) {
|
|
50875
50863
|
return cleanup(
|
|
50876
50864
|
/*result*/
|
|
@@ -50880,15 +50868,7 @@ function createTypeChecker(host) {
|
|
|
50880
50868
|
}
|
|
50881
50869
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50882
50870
|
expr,
|
|
50883
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
50884
|
-
context,
|
|
50885
|
-
a,
|
|
50886
|
-
getTypeFromTypeNode(a),
|
|
50887
|
-
/*host*/
|
|
50888
|
-
void 0,
|
|
50889
|
-
includePrivateSymbol,
|
|
50890
|
-
bundled
|
|
50891
|
-
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50871
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50892
50872
|
));
|
|
50893
50873
|
function cleanup(result2) {
|
|
50894
50874
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -51113,7 +51093,7 @@ function createTypeChecker(host) {
|
|
|
51113
51093
|
break;
|
|
51114
51094
|
case 273 /* ImportClause */: {
|
|
51115
51095
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51116
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51096
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51117
51097
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
51118
51098
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
51119
51099
|
addResult(
|
|
@@ -51135,7 +51115,7 @@ function createTypeChecker(host) {
|
|
|
51135
51115
|
}
|
|
51136
51116
|
case 274 /* NamespaceImport */: {
|
|
51137
51117
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51138
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51118
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51139
51119
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
51140
51120
|
addResult(
|
|
51141
51121
|
factory.createImportDeclaration(
|
|
@@ -51169,7 +51149,7 @@ function createTypeChecker(host) {
|
|
|
51169
51149
|
break;
|
|
51170
51150
|
case 276 /* ImportSpecifier */: {
|
|
51171
51151
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51172
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51152
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51173
51153
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
51174
51154
|
addResult(
|
|
51175
51155
|
factory.createImportDeclaration(
|
|
@@ -51323,7 +51303,7 @@ function createTypeChecker(host) {
|
|
|
51323
51303
|
varName,
|
|
51324
51304
|
/*exclamationToken*/
|
|
51325
51305
|
void 0,
|
|
51326
|
-
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration
|
|
51306
|
+
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
|
|
51327
51307
|
)
|
|
51328
51308
|
], flags)
|
|
51329
51309
|
);
|
|
@@ -51407,7 +51387,7 @@ function createTypeChecker(host) {
|
|
|
51407
51387
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
51408
51388
|
/*questionToken*/
|
|
51409
51389
|
void 0,
|
|
51410
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51390
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
|
|
51411
51391
|
)],
|
|
51412
51392
|
/*body*/
|
|
51413
51393
|
void 0
|
|
@@ -51422,7 +51402,7 @@ function createTypeChecker(host) {
|
|
|
51422
51402
|
factory.createModifiersFromModifierFlags(flag),
|
|
51423
51403
|
name,
|
|
51424
51404
|
[],
|
|
51425
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51405
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51426
51406
|
/*body*/
|
|
51427
51407
|
void 0
|
|
51428
51408
|
),
|
|
@@ -51436,7 +51416,7 @@ function createTypeChecker(host) {
|
|
|
51436
51416
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51437
51417
|
name,
|
|
51438
51418
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
51439
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration
|
|
51419
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51440
51420
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
51441
51421
|
// interface members can't have initializers, however class members _can_
|
|
51442
51422
|
/*initializer*/
|
|
@@ -60965,7 +60945,6 @@ function createTypeChecker(host) {
|
|
|
60965
60945
|
const result = isRelatedTo(
|
|
60966
60946
|
source,
|
|
60967
60947
|
target,
|
|
60968
|
-
0 /* None */,
|
|
60969
60948
|
3 /* Both */,
|
|
60970
60949
|
/*reportErrors*/
|
|
60971
60950
|
!!errorNode,
|
|
@@ -61249,7 +61228,10 @@ function createTypeChecker(host) {
|
|
|
61249
61228
|
}
|
|
61250
61229
|
return true;
|
|
61251
61230
|
}
|
|
61252
|
-
function
|
|
61231
|
+
function isRelatedToWorker(source2, target2, reportErrors2) {
|
|
61232
|
+
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
61233
|
+
}
|
|
61234
|
+
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
61253
61235
|
if (originalSource === originalTarget)
|
|
61254
61236
|
return -1 /* True */;
|
|
61255
61237
|
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 402784252 /* Primitive */) {
|
|
@@ -61309,7 +61291,7 @@ function createTypeChecker(host) {
|
|
|
61309
61291
|
if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
61310
61292
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
61311
61293
|
if (isPerformingExcessPropertyChecks) {
|
|
61312
|
-
if (hasExcessProperties(source2, target2, reportErrors2
|
|
61294
|
+
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
61313
61295
|
if (reportErrors2) {
|
|
61314
61296
|
reportRelationError(headMessage2, source2, originalTarget.aliasSymbol ? originalTarget : target2);
|
|
61315
61297
|
}
|
|
@@ -61327,14 +61309,12 @@ function createTypeChecker(host) {
|
|
|
61327
61309
|
if (calls.length > 0 && isRelatedTo(
|
|
61328
61310
|
getReturnTypeOfSignature(calls[0]),
|
|
61329
61311
|
target2,
|
|
61330
|
-
intersectionState,
|
|
61331
61312
|
1 /* Source */,
|
|
61332
61313
|
/*reportErrors*/
|
|
61333
61314
|
false
|
|
61334
61315
|
) || constructs.length > 0 && isRelatedTo(
|
|
61335
61316
|
getReturnTypeOfSignature(constructs[0]),
|
|
61336
61317
|
target2,
|
|
61337
|
-
intersectionState,
|
|
61338
61318
|
1 /* Source */,
|
|
61339
61319
|
/*reportErrors*/
|
|
61340
61320
|
false
|
|
@@ -61447,7 +61427,7 @@ function createTypeChecker(host) {
|
|
|
61447
61427
|
void 0
|
|
61448
61428
|
) || emptyArray);
|
|
61449
61429
|
}
|
|
61450
|
-
function hasExcessProperties(source2, target2, reportErrors2
|
|
61430
|
+
function hasExcessProperties(source2, target2, reportErrors2) {
|
|
61451
61431
|
var _a2;
|
|
61452
61432
|
if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) {
|
|
61453
61433
|
return false;
|
|
@@ -61459,11 +61439,7 @@ function createTypeChecker(host) {
|
|
|
61459
61439
|
let reducedTarget = target2;
|
|
61460
61440
|
let checkTypes;
|
|
61461
61441
|
if (target2.flags & 1048576 /* Union */) {
|
|
61462
|
-
|
|
61463
|
-
return isRelatedTo(source3, target3, intersectionState);
|
|
61464
|
-
};
|
|
61465
|
-
var isRelatedToWorker = isRelatedToWorker2;
|
|
61466
|
-
reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedToWorker2) || filterPrimitivesIfContainsNonPrimitive(target2);
|
|
61442
|
+
reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target2);
|
|
61467
61443
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
61468
61444
|
}
|
|
61469
61445
|
for (const prop of getPropertiesOfType(source2)) {
|
|
@@ -61506,7 +61482,7 @@ function createTypeChecker(host) {
|
|
|
61506
61482
|
}
|
|
61507
61483
|
return true;
|
|
61508
61484
|
}
|
|
61509
|
-
if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName),
|
|
61485
|
+
if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), 3 /* Both */, reportErrors2)) {
|
|
61510
61486
|
if (reportErrors2) {
|
|
61511
61487
|
reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop));
|
|
61512
61488
|
}
|
|
@@ -61550,14 +61526,12 @@ function createTypeChecker(host) {
|
|
|
61550
61526
|
return isRelatedTo(
|
|
61551
61527
|
source2,
|
|
61552
61528
|
target2,
|
|
61553
|
-
intersectionState,
|
|
61554
61529
|
1 /* Source */,
|
|
61555
61530
|
/*reportErrors*/
|
|
61556
61531
|
false
|
|
61557
61532
|
) || isRelatedTo(
|
|
61558
61533
|
target2,
|
|
61559
61534
|
source2,
|
|
61560
|
-
intersectionState,
|
|
61561
61535
|
1 /* Source */,
|
|
61562
61536
|
/*reportErrors*/
|
|
61563
61537
|
false
|
|
@@ -61573,7 +61547,7 @@ function createTypeChecker(host) {
|
|
|
61573
61547
|
1 /* Source */
|
|
61574
61548
|
);
|
|
61575
61549
|
}
|
|
61576
|
-
function eachTypeRelatedToSomeType(source2, target2
|
|
61550
|
+
function eachTypeRelatedToSomeType(source2, target2) {
|
|
61577
61551
|
let result2 = -1 /* True */;
|
|
61578
61552
|
const sourceTypes = source2.types;
|
|
61579
61553
|
for (const sourceType of sourceTypes) {
|
|
@@ -61582,7 +61556,7 @@ function createTypeChecker(host) {
|
|
|
61582
61556
|
target2,
|
|
61583
61557
|
/*reportErrors*/
|
|
61584
61558
|
false,
|
|
61585
|
-
|
|
61559
|
+
0 /* None */
|
|
61586
61560
|
);
|
|
61587
61561
|
if (!related) {
|
|
61588
61562
|
return 0 /* False */;
|
|
@@ -61607,12 +61581,12 @@ function createTypeChecker(host) {
|
|
|
61607
61581
|
const related = isRelatedTo(
|
|
61608
61582
|
source2,
|
|
61609
61583
|
match,
|
|
61610
|
-
intersectionState,
|
|
61611
61584
|
2 /* Target */,
|
|
61612
61585
|
/*reportErrors*/
|
|
61613
61586
|
false,
|
|
61614
61587
|
/*headMessage*/
|
|
61615
|
-
void 0
|
|
61588
|
+
void 0,
|
|
61589
|
+
intersectionState
|
|
61616
61590
|
);
|
|
61617
61591
|
if (related) {
|
|
61618
61592
|
return related;
|
|
@@ -61623,31 +61597,29 @@ function createTypeChecker(host) {
|
|
|
61623
61597
|
const related = isRelatedTo(
|
|
61624
61598
|
source2,
|
|
61625
61599
|
type,
|
|
61626
|
-
intersectionState,
|
|
61627
61600
|
2 /* Target */,
|
|
61628
61601
|
/*reportErrors*/
|
|
61629
61602
|
false,
|
|
61630
61603
|
/*headMessage*/
|
|
61631
|
-
void 0
|
|
61604
|
+
void 0,
|
|
61605
|
+
intersectionState
|
|
61632
61606
|
);
|
|
61633
61607
|
if (related) {
|
|
61634
61608
|
return related;
|
|
61635
61609
|
}
|
|
61636
61610
|
}
|
|
61637
61611
|
if (reportErrors2) {
|
|
61638
|
-
|
|
61639
|
-
return isRelatedTo(source3, target3, intersectionState);
|
|
61640
|
-
};
|
|
61641
|
-
var isRelatedToWorker = isRelatedToWorker2;
|
|
61642
|
-
const bestMatchingType = getBestMatchingType(source2, target2, isRelatedToWorker2);
|
|
61612
|
+
const bestMatchingType = getBestMatchingType(source2, target2, isRelatedTo);
|
|
61643
61613
|
if (bestMatchingType) {
|
|
61644
61614
|
isRelatedTo(
|
|
61645
61615
|
source2,
|
|
61646
61616
|
bestMatchingType,
|
|
61647
|
-
intersectionState,
|
|
61648
61617
|
2 /* Target */,
|
|
61649
61618
|
/*reportErrors*/
|
|
61650
|
-
true
|
|
61619
|
+
true,
|
|
61620
|
+
/*headMessage*/
|
|
61621
|
+
void 0,
|
|
61622
|
+
intersectionState
|
|
61651
61623
|
);
|
|
61652
61624
|
}
|
|
61653
61625
|
}
|
|
@@ -61660,11 +61632,11 @@ function createTypeChecker(host) {
|
|
|
61660
61632
|
const related = isRelatedTo(
|
|
61661
61633
|
source2,
|
|
61662
61634
|
targetType,
|
|
61663
|
-
intersectionState,
|
|
61664
61635
|
2 /* Target */,
|
|
61665
61636
|
reportErrors2,
|
|
61666
61637
|
/*headMessage*/
|
|
61667
|
-
void 0
|
|
61638
|
+
void 0,
|
|
61639
|
+
intersectionState
|
|
61668
61640
|
);
|
|
61669
61641
|
if (!related) {
|
|
61670
61642
|
return 0 /* False */;
|
|
@@ -61683,11 +61655,11 @@ function createTypeChecker(host) {
|
|
|
61683
61655
|
const related = isRelatedTo(
|
|
61684
61656
|
sourceTypes[i],
|
|
61685
61657
|
target2,
|
|
61686
|
-
intersectionState,
|
|
61687
61658
|
1 /* Source */,
|
|
61688
61659
|
reportErrors2 && i === len - 1,
|
|
61689
61660
|
/*headMessage*/
|
|
61690
|
-
void 0
|
|
61661
|
+
void 0,
|
|
61662
|
+
intersectionState
|
|
61691
61663
|
);
|
|
61692
61664
|
if (related) {
|
|
61693
61665
|
return related;
|
|
@@ -61711,12 +61683,12 @@ function createTypeChecker(host) {
|
|
|
61711
61683
|
const related2 = isRelatedTo(
|
|
61712
61684
|
sourceType,
|
|
61713
61685
|
undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length],
|
|
61714
|
-
intersectionState,
|
|
61715
61686
|
3 /* Both */,
|
|
61716
61687
|
/*reportErrors*/
|
|
61717
61688
|
false,
|
|
61718
61689
|
/*headMessage*/
|
|
61719
|
-
void 0
|
|
61690
|
+
void 0,
|
|
61691
|
+
intersectionState
|
|
61720
61692
|
);
|
|
61721
61693
|
if (related2) {
|
|
61722
61694
|
result2 &= related2;
|
|
@@ -61726,11 +61698,11 @@ function createTypeChecker(host) {
|
|
|
61726
61698
|
const related = isRelatedTo(
|
|
61727
61699
|
sourceType,
|
|
61728
61700
|
target2,
|
|
61729
|
-
intersectionState,
|
|
61730
61701
|
1 /* Source */,
|
|
61731
61702
|
reportErrors2,
|
|
61732
61703
|
/*headMessage*/
|
|
61733
|
-
void 0
|
|
61704
|
+
void 0,
|
|
61705
|
+
intersectionState
|
|
61734
61706
|
);
|
|
61735
61707
|
if (!related) {
|
|
61736
61708
|
return 0 /* False */;
|
|
@@ -61756,7 +61728,6 @@ function createTypeChecker(host) {
|
|
|
61756
61728
|
related = relation === identityRelation ? isRelatedTo(
|
|
61757
61729
|
s,
|
|
61758
61730
|
t,
|
|
61759
|
-
intersectionState,
|
|
61760
61731
|
3 /* Both */,
|
|
61761
61732
|
/*reportErrors*/
|
|
61762
61733
|
false
|
|
@@ -61765,27 +61736,26 @@ function createTypeChecker(host) {
|
|
|
61765
61736
|
related = isRelatedTo(
|
|
61766
61737
|
s,
|
|
61767
61738
|
t,
|
|
61768
|
-
intersectionState,
|
|
61769
61739
|
3 /* Both */,
|
|
61770
61740
|
reportErrors2,
|
|
61771
61741
|
/*headMessage*/
|
|
61772
|
-
void 0
|
|
61742
|
+
void 0,
|
|
61743
|
+
intersectionState
|
|
61773
61744
|
);
|
|
61774
61745
|
} else if (variance === 2 /* Contravariant */) {
|
|
61775
61746
|
related = isRelatedTo(
|
|
61776
61747
|
t,
|
|
61777
61748
|
s,
|
|
61778
|
-
intersectionState,
|
|
61779
61749
|
3 /* Both */,
|
|
61780
61750
|
reportErrors2,
|
|
61781
61751
|
/*headMessage*/
|
|
61782
|
-
void 0
|
|
61752
|
+
void 0,
|
|
61753
|
+
intersectionState
|
|
61783
61754
|
);
|
|
61784
61755
|
} else if (variance === 3 /* Bivariant */) {
|
|
61785
61756
|
related = isRelatedTo(
|
|
61786
61757
|
t,
|
|
61787
61758
|
s,
|
|
61788
|
-
intersectionState,
|
|
61789
61759
|
3 /* Both */,
|
|
61790
61760
|
/*reportErrors*/
|
|
61791
61761
|
false
|
|
@@ -61794,32 +61764,32 @@ function createTypeChecker(host) {
|
|
|
61794
61764
|
related = isRelatedTo(
|
|
61795
61765
|
s,
|
|
61796
61766
|
t,
|
|
61797
|
-
intersectionState,
|
|
61798
61767
|
3 /* Both */,
|
|
61799
61768
|
reportErrors2,
|
|
61800
61769
|
/*headMessage*/
|
|
61801
|
-
void 0
|
|
61770
|
+
void 0,
|
|
61771
|
+
intersectionState
|
|
61802
61772
|
);
|
|
61803
61773
|
}
|
|
61804
61774
|
} else {
|
|
61805
61775
|
related = isRelatedTo(
|
|
61806
61776
|
s,
|
|
61807
61777
|
t,
|
|
61808
|
-
intersectionState,
|
|
61809
61778
|
3 /* Both */,
|
|
61810
61779
|
reportErrors2,
|
|
61811
61780
|
/*headMessage*/
|
|
61812
|
-
void 0
|
|
61781
|
+
void 0,
|
|
61782
|
+
intersectionState
|
|
61813
61783
|
);
|
|
61814
61784
|
if (related) {
|
|
61815
61785
|
related &= isRelatedTo(
|
|
61816
61786
|
t,
|
|
61817
61787
|
s,
|
|
61818
|
-
intersectionState,
|
|
61819
61788
|
3 /* Both */,
|
|
61820
61789
|
reportErrors2,
|
|
61821
61790
|
/*headMessage*/
|
|
61822
|
-
void 0
|
|
61791
|
+
void 0,
|
|
61792
|
+
intersectionState
|
|
61823
61793
|
);
|
|
61824
61794
|
}
|
|
61825
61795
|
}
|
|
@@ -61985,12 +61955,12 @@ function createTypeChecker(host) {
|
|
|
61985
61955
|
result2 = isRelatedTo(
|
|
61986
61956
|
constraint,
|
|
61987
61957
|
target2,
|
|
61988
|
-
intersectionState,
|
|
61989
61958
|
1 /* Source */,
|
|
61990
61959
|
/*reportErrors*/
|
|
61991
61960
|
false,
|
|
61992
61961
|
/*headMessage*/
|
|
61993
|
-
void 0
|
|
61962
|
+
void 0,
|
|
61963
|
+
intersectionState
|
|
61994
61964
|
);
|
|
61995
61965
|
}
|
|
61996
61966
|
}
|
|
@@ -62053,9 +62023,9 @@ function createTypeChecker(host) {
|
|
|
62053
62023
|
const targetFlags = target2.flags;
|
|
62054
62024
|
if (relation === identityRelation) {
|
|
62055
62025
|
if (sourceFlags & 3145728 /* UnionOrIntersection */) {
|
|
62056
|
-
let result3 = eachTypeRelatedToSomeType(source2, target2
|
|
62026
|
+
let result3 = eachTypeRelatedToSomeType(source2, target2);
|
|
62057
62027
|
if (result3) {
|
|
62058
|
-
result3 &= eachTypeRelatedToSomeType(target2, source2
|
|
62028
|
+
result3 &= eachTypeRelatedToSomeType(target2, source2);
|
|
62059
62029
|
}
|
|
62060
62030
|
return result3;
|
|
62061
62031
|
}
|
|
@@ -62063,7 +62033,6 @@ function createTypeChecker(host) {
|
|
|
62063
62033
|
return isRelatedTo(
|
|
62064
62034
|
source2.type,
|
|
62065
62035
|
target2.type,
|
|
62066
|
-
intersectionState,
|
|
62067
62036
|
3 /* Both */,
|
|
62068
62037
|
/*reportErrors*/
|
|
62069
62038
|
false
|
|
@@ -62073,7 +62042,6 @@ function createTypeChecker(host) {
|
|
|
62073
62042
|
if (result2 = isRelatedTo(
|
|
62074
62043
|
source2.objectType,
|
|
62075
62044
|
target2.objectType,
|
|
62076
|
-
intersectionState,
|
|
62077
62045
|
3 /* Both */,
|
|
62078
62046
|
/*reportErrors*/
|
|
62079
62047
|
false
|
|
@@ -62081,7 +62049,6 @@ function createTypeChecker(host) {
|
|
|
62081
62049
|
if (result2 &= isRelatedTo(
|
|
62082
62050
|
source2.indexType,
|
|
62083
62051
|
target2.indexType,
|
|
62084
|
-
intersectionState,
|
|
62085
62052
|
3 /* Both */,
|
|
62086
62053
|
/*reportErrors*/
|
|
62087
62054
|
false
|
|
@@ -62095,7 +62062,6 @@ function createTypeChecker(host) {
|
|
|
62095
62062
|
if (result2 = isRelatedTo(
|
|
62096
62063
|
source2.checkType,
|
|
62097
62064
|
target2.checkType,
|
|
62098
|
-
intersectionState,
|
|
62099
62065
|
3 /* Both */,
|
|
62100
62066
|
/*reportErrors*/
|
|
62101
62067
|
false
|
|
@@ -62103,7 +62069,6 @@ function createTypeChecker(host) {
|
|
|
62103
62069
|
if (result2 &= isRelatedTo(
|
|
62104
62070
|
source2.extendsType,
|
|
62105
62071
|
target2.extendsType,
|
|
62106
|
-
intersectionState,
|
|
62107
62072
|
3 /* Both */,
|
|
62108
62073
|
/*reportErrors*/
|
|
62109
62074
|
false
|
|
@@ -62111,7 +62076,6 @@ function createTypeChecker(host) {
|
|
|
62111
62076
|
if (result2 &= isRelatedTo(
|
|
62112
62077
|
getTrueTypeFromConditionalType(source2),
|
|
62113
62078
|
getTrueTypeFromConditionalType(target2),
|
|
62114
|
-
intersectionState,
|
|
62115
62079
|
3 /* Both */,
|
|
62116
62080
|
/*reportErrors*/
|
|
62117
62081
|
false
|
|
@@ -62119,7 +62083,6 @@ function createTypeChecker(host) {
|
|
|
62119
62083
|
if (result2 &= isRelatedTo(
|
|
62120
62084
|
getFalseTypeFromConditionalType(source2),
|
|
62121
62085
|
getFalseTypeFromConditionalType(target2),
|
|
62122
|
-
intersectionState,
|
|
62123
62086
|
3 /* Both */,
|
|
62124
62087
|
/*reportErrors*/
|
|
62125
62088
|
false
|
|
@@ -62135,7 +62098,6 @@ function createTypeChecker(host) {
|
|
|
62135
62098
|
if (result2 = isRelatedTo(
|
|
62136
62099
|
source2.baseType,
|
|
62137
62100
|
target2.baseType,
|
|
62138
|
-
intersectionState,
|
|
62139
62101
|
3 /* Both */,
|
|
62140
62102
|
/*reportErrors*/
|
|
62141
62103
|
false
|
|
@@ -62143,7 +62105,6 @@ function createTypeChecker(host) {
|
|
|
62143
62105
|
if (result2 &= isRelatedTo(
|
|
62144
62106
|
source2.constraint,
|
|
62145
62107
|
target2.constraint,
|
|
62146
|
-
intersectionState,
|
|
62147
62108
|
3 /* Both */,
|
|
62148
62109
|
/*reportErrors*/
|
|
62149
62110
|
false
|
|
@@ -62177,15 +62138,15 @@ function createTypeChecker(host) {
|
|
|
62177
62138
|
return varianceResult;
|
|
62178
62139
|
}
|
|
62179
62140
|
}
|
|
62180
|
-
if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2,
|
|
62141
|
+
if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2, 1 /* Source */)) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo(source2, getTypeArguments(target2)[0], 2 /* Target */))) {
|
|
62181
62142
|
return result2;
|
|
62182
62143
|
}
|
|
62183
62144
|
if (targetFlags & 262144 /* TypeParameter */) {
|
|
62184
|
-
if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2),
|
|
62145
|
+
if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3 /* Both */)) {
|
|
62185
62146
|
if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */)) {
|
|
62186
62147
|
const templateType = getTemplateTypeFromMappedType(source2);
|
|
62187
62148
|
const indexedAccessType = getIndexedAccessType(target2, getTypeParameterFromMappedType(source2));
|
|
62188
|
-
if (result2 = isRelatedTo(templateType, indexedAccessType,
|
|
62149
|
+
if (result2 = isRelatedTo(templateType, indexedAccessType, 3 /* Both */, reportErrors2)) {
|
|
62189
62150
|
return result2;
|
|
62190
62151
|
}
|
|
62191
62152
|
}
|
|
@@ -62197,7 +62158,6 @@ function createTypeChecker(host) {
|
|
|
62197
62158
|
if (result2 = isRelatedTo(
|
|
62198
62159
|
constraint,
|
|
62199
62160
|
target2,
|
|
62200
|
-
intersectionState,
|
|
62201
62161
|
1 /* Source */,
|
|
62202
62162
|
/*reportErrors*/
|
|
62203
62163
|
false
|
|
@@ -62215,7 +62175,6 @@ function createTypeChecker(host) {
|
|
|
62215
62175
|
if (result2 = isRelatedTo(
|
|
62216
62176
|
targetType,
|
|
62217
62177
|
source2.type,
|
|
62218
|
-
intersectionState,
|
|
62219
62178
|
3 /* Both */,
|
|
62220
62179
|
/*reportErrors*/
|
|
62221
62180
|
false
|
|
@@ -62224,13 +62183,13 @@ function createTypeChecker(host) {
|
|
|
62224
62183
|
}
|
|
62225
62184
|
}
|
|
62226
62185
|
if (isTupleType(targetType)) {
|
|
62227
|
-
if (result2 = isRelatedTo(source2, getKnownKeysOfTupleType(targetType),
|
|
62186
|
+
if (result2 = isRelatedTo(source2, getKnownKeysOfTupleType(targetType), 2 /* Target */, reportErrors2)) {
|
|
62228
62187
|
return result2;
|
|
62229
62188
|
}
|
|
62230
62189
|
} else {
|
|
62231
62190
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
62232
62191
|
if (constraint) {
|
|
62233
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */),
|
|
62192
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
62234
62193
|
return -1 /* True */;
|
|
62235
62194
|
}
|
|
62236
62195
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -62243,15 +62202,15 @@ function createTypeChecker(host) {
|
|
|
62243
62202
|
} else {
|
|
62244
62203
|
targetKeys = nameType || constraintType;
|
|
62245
62204
|
}
|
|
62246
|
-
if (isRelatedTo(source2, targetKeys,
|
|
62205
|
+
if (isRelatedTo(source2, targetKeys, 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
62247
62206
|
return -1 /* True */;
|
|
62248
62207
|
}
|
|
62249
62208
|
}
|
|
62250
62209
|
}
|
|
62251
62210
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
62252
62211
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
62253
|
-
if (result2 = isRelatedTo(source2.objectType, target2.objectType,
|
|
62254
|
-
result2 &= isRelatedTo(source2.indexType, target2.indexType,
|
|
62212
|
+
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
62213
|
+
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
62255
62214
|
}
|
|
62256
62215
|
if (result2) {
|
|
62257
62216
|
return result2;
|
|
@@ -62275,11 +62234,11 @@ function createTypeChecker(host) {
|
|
|
62275
62234
|
if (result2 = isRelatedTo(
|
|
62276
62235
|
source2,
|
|
62277
62236
|
constraint,
|
|
62278
|
-
intersectionState,
|
|
62279
62237
|
2 /* Target */,
|
|
62280
62238
|
reportErrors2,
|
|
62281
62239
|
/*headMessage*/
|
|
62282
|
-
void 0
|
|
62240
|
+
void 0,
|
|
62241
|
+
intersectionState
|
|
62283
62242
|
)) {
|
|
62284
62243
|
return result2;
|
|
62285
62244
|
}
|
|
@@ -62305,18 +62264,18 @@ function createTypeChecker(host) {
|
|
|
62305
62264
|
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
62306
62265
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
62307
62266
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
62308
|
-
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys,
|
|
62267
|
+
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
62309
62268
|
const templateType2 = getTemplateTypeFromMappedType(target2);
|
|
62310
62269
|
const typeParameter = getTypeParameterFromMappedType(target2);
|
|
62311
62270
|
const nonNullComponent = extractTypesOfKind(templateType2, ~98304 /* Nullable */);
|
|
62312
62271
|
if (!keysRemapped && nonNullComponent.flags & 8388608 /* IndexedAccess */ && nonNullComponent.indexType === typeParameter) {
|
|
62313
|
-
if (result2 = isRelatedTo(source2, nonNullComponent.objectType,
|
|
62272
|
+
if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2 /* Target */, reportErrors2)) {
|
|
62314
62273
|
return result2;
|
|
62315
62274
|
}
|
|
62316
62275
|
} else {
|
|
62317
62276
|
const indexingType = keysRemapped ? filteredByApplicability || targetKeys : filteredByApplicability ? getIntersectionType([filteredByApplicability, typeParameter]) : typeParameter;
|
|
62318
62277
|
const indexedAccessType = getIndexedAccessType(source2, indexingType);
|
|
62319
|
-
if (result2 = isRelatedTo(indexedAccessType, templateType2,
|
|
62278
|
+
if (result2 = isRelatedTo(indexedAccessType, templateType2, 3 /* Both */, reportErrors2)) {
|
|
62320
62279
|
return result2;
|
|
62321
62280
|
}
|
|
62322
62281
|
}
|
|
@@ -62336,22 +62295,22 @@ function createTypeChecker(host) {
|
|
|
62336
62295
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
62337
62296
|
source2,
|
|
62338
62297
|
getTrueTypeFromConditionalType(c),
|
|
62339
|
-
intersectionState,
|
|
62340
62298
|
2 /* Target */,
|
|
62341
62299
|
/*reportErrors*/
|
|
62342
62300
|
false,
|
|
62343
62301
|
/*headMessage*/
|
|
62344
|
-
void 0
|
|
62302
|
+
void 0,
|
|
62303
|
+
intersectionState
|
|
62345
62304
|
)) {
|
|
62346
62305
|
result2 &= skipFalse ? -1 /* True */ : isRelatedTo(
|
|
62347
62306
|
source2,
|
|
62348
62307
|
getFalseTypeFromConditionalType(c),
|
|
62349
|
-
intersectionState,
|
|
62350
62308
|
2 /* Target */,
|
|
62351
62309
|
/*reportErrors*/
|
|
62352
62310
|
false,
|
|
62353
62311
|
/*headMessage*/
|
|
62354
|
-
void 0
|
|
62312
|
+
void 0,
|
|
62313
|
+
intersectionState
|
|
62355
62314
|
);
|
|
62356
62315
|
if (result2) {
|
|
62357
62316
|
return result2;
|
|
@@ -62381,29 +62340,29 @@ function createTypeChecker(host) {
|
|
|
62381
62340
|
if (result2 = isRelatedTo(
|
|
62382
62341
|
constraint,
|
|
62383
62342
|
target2,
|
|
62384
|
-
intersectionState,
|
|
62385
62343
|
1 /* Source */,
|
|
62386
62344
|
/*reportErrors*/
|
|
62387
62345
|
false,
|
|
62388
62346
|
/*headMessage*/
|
|
62389
|
-
void 0
|
|
62347
|
+
void 0,
|
|
62348
|
+
intersectionState
|
|
62390
62349
|
)) {
|
|
62391
62350
|
return result2;
|
|
62392
62351
|
} else if (result2 = isRelatedTo(
|
|
62393
62352
|
getTypeWithThisArgument(constraint, source2),
|
|
62394
62353
|
target2,
|
|
62395
|
-
intersectionState,
|
|
62396
62354
|
1 /* Source */,
|
|
62397
62355
|
reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */),
|
|
62398
62356
|
/*headMessage*/
|
|
62399
|
-
void 0
|
|
62357
|
+
void 0,
|
|
62358
|
+
intersectionState
|
|
62400
62359
|
)) {
|
|
62401
62360
|
return result2;
|
|
62402
62361
|
}
|
|
62403
62362
|
if (isMappedTypeGenericIndexedAccess(source2)) {
|
|
62404
62363
|
const indexConstraint = getConstraintOfType(source2.indexType);
|
|
62405
62364
|
if (indexConstraint) {
|
|
62406
|
-
if (result2 = isRelatedTo(getIndexedAccessType(source2.objectType, indexConstraint), target2,
|
|
62365
|
+
if (result2 = isRelatedTo(getIndexedAccessType(source2.objectType, indexConstraint), target2, 1 /* Source */, reportErrors2)) {
|
|
62407
62366
|
return result2;
|
|
62408
62367
|
}
|
|
62409
62368
|
}
|
|
@@ -62411,21 +62370,21 @@ function createTypeChecker(host) {
|
|
|
62411
62370
|
}
|
|
62412
62371
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
62413
62372
|
const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
|
|
62414
|
-
if (result2 = isRelatedTo(stringNumberSymbolType, target2,
|
|
62373
|
+
if (result2 = isRelatedTo(stringNumberSymbolType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
62415
62374
|
return result2;
|
|
62416
62375
|
}
|
|
62417
62376
|
if (isDeferredMappedIndex) {
|
|
62418
62377
|
const mappedType = source2.type;
|
|
62419
62378
|
const nameType = getNameTypeFromMappedType(mappedType);
|
|
62420
62379
|
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
62421
|
-
if (result2 = isRelatedTo(sourceMappedKeys, target2,
|
|
62380
|
+
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
62422
62381
|
return result2;
|
|
62423
62382
|
}
|
|
62424
62383
|
}
|
|
62425
62384
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
62426
62385
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
62427
62386
|
const constraint = getBaseConstraintOfType(source2);
|
|
62428
|
-
if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2,
|
|
62387
|
+
if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
|
|
62429
62388
|
return result2;
|
|
62430
62389
|
}
|
|
62431
62390
|
}
|
|
@@ -62434,12 +62393,12 @@ function createTypeChecker(host) {
|
|
|
62434
62393
|
if (source2.symbol !== target2.symbol) {
|
|
62435
62394
|
return 0 /* False */;
|
|
62436
62395
|
}
|
|
62437
|
-
if (result2 = isRelatedTo(source2.type, target2.type,
|
|
62396
|
+
if (result2 = isRelatedTo(source2.type, target2.type, 3 /* Both */, reportErrors2)) {
|
|
62438
62397
|
return result2;
|
|
62439
62398
|
}
|
|
62440
62399
|
} else {
|
|
62441
62400
|
const constraint = getBaseConstraintOfType(source2);
|
|
62442
|
-
if (constraint && (result2 = isRelatedTo(constraint, target2,
|
|
62401
|
+
if (constraint && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
|
|
62443
62402
|
return result2;
|
|
62444
62403
|
}
|
|
62445
62404
|
}
|
|
@@ -62452,24 +62411,20 @@ function createTypeChecker(host) {
|
|
|
62452
62411
|
let sourceExtends = source2.extendsType;
|
|
62453
62412
|
let mapper;
|
|
62454
62413
|
if (sourceParams) {
|
|
62455
|
-
let isRelatedToWorker2 = function(source3, target3, reportErrors3) {
|
|
62456
|
-
return isRelatedTo(source3, target3, 0 /* None */, 3 /* Both */, reportErrors3);
|
|
62457
|
-
};
|
|
62458
|
-
var isRelatedToWorker = isRelatedToWorker2;
|
|
62459
62414
|
const ctx = createInferenceContext(
|
|
62460
62415
|
sourceParams,
|
|
62461
62416
|
/*signature*/
|
|
62462
62417
|
void 0,
|
|
62463
62418
|
0 /* None */,
|
|
62464
|
-
|
|
62419
|
+
isRelatedToWorker
|
|
62465
62420
|
);
|
|
62466
62421
|
inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
62467
62422
|
sourceExtends = instantiateType(sourceExtends, ctx.mapper);
|
|
62468
62423
|
mapper = ctx.mapper;
|
|
62469
62424
|
}
|
|
62470
|
-
if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType,
|
|
62471
|
-
if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2),
|
|
62472
|
-
result2 &= isRelatedTo(getFalseTypeFromConditionalType(source2), getFalseTypeFromConditionalType(target2),
|
|
62425
|
+
if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType, 3 /* Both */) || isRelatedTo(target2.checkType, source2.checkType, 3 /* Both */))) {
|
|
62426
|
+
if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), 3 /* Both */, reportErrors2)) {
|
|
62427
|
+
result2 &= isRelatedTo(getFalseTypeFromConditionalType(source2), getFalseTypeFromConditionalType(target2), 3 /* Both */, reportErrors2);
|
|
62473
62428
|
}
|
|
62474
62429
|
if (result2) {
|
|
62475
62430
|
return result2;
|
|
@@ -62478,14 +62433,14 @@ function createTypeChecker(host) {
|
|
|
62478
62433
|
}
|
|
62479
62434
|
const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
|
|
62480
62435
|
if (defaultConstraint) {
|
|
62481
|
-
if (result2 = isRelatedTo(defaultConstraint, target2,
|
|
62436
|
+
if (result2 = isRelatedTo(defaultConstraint, target2, 1 /* Source */, reportErrors2)) {
|
|
62482
62437
|
return result2;
|
|
62483
62438
|
}
|
|
62484
62439
|
}
|
|
62485
62440
|
const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
|
|
62486
62441
|
if (distributiveConstraint) {
|
|
62487
62442
|
resetErrorInfo(saveErrorInfo);
|
|
62488
|
-
if (result2 = isRelatedTo(distributiveConstraint, target2,
|
|
62443
|
+
if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
|
|
62489
62444
|
return result2;
|
|
62490
62445
|
}
|
|
62491
62446
|
}
|
|
@@ -62495,7 +62450,7 @@ function createTypeChecker(host) {
|
|
|
62495
62450
|
}
|
|
62496
62451
|
if (isGenericMappedType(target2)) {
|
|
62497
62452
|
if (isGenericMappedType(source2)) {
|
|
62498
|
-
if (result2 = mappedTypeRelatedTo(source2, target2, reportErrors2
|
|
62453
|
+
if (result2 = mappedTypeRelatedTo(source2, target2, reportErrors2)) {
|
|
62499
62454
|
return result2;
|
|
62500
62455
|
}
|
|
62501
62456
|
}
|
|
@@ -62522,14 +62477,14 @@ function createTypeChecker(host) {
|
|
|
62522
62477
|
}
|
|
62523
62478
|
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
62524
62479
|
if (relation !== identityRelation) {
|
|
62525
|
-
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType,
|
|
62480
|
+
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
62526
62481
|
} else {
|
|
62527
62482
|
return 0 /* False */;
|
|
62528
62483
|
}
|
|
62529
62484
|
} else if (isGenericTupleType(source2) && isTupleType(target2) && !isGenericTupleType(target2)) {
|
|
62530
62485
|
const constraint = getBaseConstraintOrType(source2);
|
|
62531
62486
|
if (constraint !== source2) {
|
|
62532
|
-
return isRelatedTo(constraint, target2,
|
|
62487
|
+
return isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2);
|
|
62533
62488
|
}
|
|
62534
62489
|
} else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && getObjectFlags(target2) & 8192 /* FreshLiteral */ && !isEmptyObjectType(source2)) {
|
|
62535
62490
|
return 0 /* False */;
|
|
@@ -62597,16 +62552,16 @@ function createTypeChecker(host) {
|
|
|
62597
62552
|
}
|
|
62598
62553
|
}
|
|
62599
62554
|
}
|
|
62600
|
-
function mappedTypeRelatedTo(source2, target2, reportErrors2
|
|
62555
|
+
function mappedTypeRelatedTo(source2, target2, reportErrors2) {
|
|
62601
62556
|
const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getCombinedMappedTypeOptionality(source2) <= getCombinedMappedTypeOptionality(target2));
|
|
62602
62557
|
if (modifiersRelated) {
|
|
62603
62558
|
let result2;
|
|
62604
62559
|
const targetConstraint = getConstraintTypeFromMappedType(target2);
|
|
62605
62560
|
const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getCombinedMappedTypeOptionality(source2) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
62606
|
-
if (result2 = isRelatedTo(targetConstraint, sourceConstraint,
|
|
62561
|
+
if (result2 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors2)) {
|
|
62607
62562
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(source2)], [getTypeParameterFromMappedType(target2)]);
|
|
62608
62563
|
if (instantiateType(getNameTypeFromMappedType(source2), mapper) === instantiateType(getNameTypeFromMappedType(target2), mapper)) {
|
|
62609
|
-
return result2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source2), mapper), getTemplateTypeFromMappedType(target2),
|
|
62564
|
+
return result2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source2), mapper), getTemplateTypeFromMappedType(target2), 3 /* Both */, reportErrors2);
|
|
62610
62565
|
}
|
|
62611
62566
|
}
|
|
62612
62567
|
}
|
|
@@ -62746,11 +62701,11 @@ function createTypeChecker(host) {
|
|
|
62746
62701
|
return isRelatedTo(
|
|
62747
62702
|
effectiveSource,
|
|
62748
62703
|
effectiveTarget,
|
|
62749
|
-
intersectionState,
|
|
62750
62704
|
3 /* Both */,
|
|
62751
62705
|
reportErrors2,
|
|
62752
62706
|
/*headMessage*/
|
|
62753
|
-
void 0
|
|
62707
|
+
void 0,
|
|
62708
|
+
intersectionState
|
|
62754
62709
|
);
|
|
62755
62710
|
}
|
|
62756
62711
|
function propertyRelatedTo(source2, target2, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState, skipOptional) {
|
|
@@ -62858,7 +62813,7 @@ function createTypeChecker(host) {
|
|
|
62858
62813
|
}
|
|
62859
62814
|
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
62860
62815
|
if (relation === identityRelation) {
|
|
62861
|
-
return propertiesIdenticalTo(source2, target2, excludedProperties
|
|
62816
|
+
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
62862
62817
|
}
|
|
62863
62818
|
let result2 = -1 /* True */;
|
|
62864
62819
|
if (isTupleType(target2)) {
|
|
@@ -62937,11 +62892,11 @@ function createTypeChecker(host) {
|
|
|
62937
62892
|
const related = isRelatedTo(
|
|
62938
62893
|
sourceType,
|
|
62939
62894
|
targetCheckType,
|
|
62940
|
-
intersectionState,
|
|
62941
62895
|
3 /* Both */,
|
|
62942
62896
|
reportErrors2,
|
|
62943
62897
|
/*headMessage*/
|
|
62944
|
-
void 0
|
|
62898
|
+
void 0,
|
|
62899
|
+
intersectionState
|
|
62945
62900
|
);
|
|
62946
62901
|
if (!related) {
|
|
62947
62902
|
if (reportErrors2 && (targetArity > 1 || sourceArity > 1)) {
|
|
@@ -63005,7 +62960,7 @@ function createTypeChecker(host) {
|
|
|
63005
62960
|
}
|
|
63006
62961
|
return result2;
|
|
63007
62962
|
}
|
|
63008
|
-
function propertiesIdenticalTo(source2, target2, excludedProperties
|
|
62963
|
+
function propertiesIdenticalTo(source2, target2, excludedProperties) {
|
|
63009
62964
|
if (!(source2.flags & 524288 /* Object */ && target2.flags & 524288 /* Object */)) {
|
|
63010
62965
|
return 0 /* False */;
|
|
63011
62966
|
}
|
|
@@ -63020,21 +62975,18 @@ function createTypeChecker(host) {
|
|
|
63020
62975
|
if (!targetProp) {
|
|
63021
62976
|
return 0 /* False */;
|
|
63022
62977
|
}
|
|
63023
|
-
const related = compareProperties(sourceProp, targetProp,
|
|
62978
|
+
const related = compareProperties(sourceProp, targetProp, isRelatedTo);
|
|
63024
62979
|
if (!related) {
|
|
63025
62980
|
return 0 /* False */;
|
|
63026
62981
|
}
|
|
63027
62982
|
result2 &= related;
|
|
63028
62983
|
}
|
|
63029
62984
|
return result2;
|
|
63030
|
-
function isRelatedToWorker(source3, target3) {
|
|
63031
|
-
return isRelatedTo(source3, target3, intersectionState);
|
|
63032
|
-
}
|
|
63033
62985
|
}
|
|
63034
62986
|
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
63035
62987
|
var _a2, _b;
|
|
63036
62988
|
if (relation === identityRelation) {
|
|
63037
|
-
return signaturesIdenticalTo(source2, target2, kind
|
|
62989
|
+
return signaturesIdenticalTo(source2, target2, kind);
|
|
63038
62990
|
}
|
|
63039
62991
|
if (target2 === anyFunctionType || source2 === anyFunctionType) {
|
|
63040
62992
|
return -1 /* True */;
|
|
@@ -63163,20 +63115,20 @@ function createTypeChecker(host) {
|
|
|
63163
63115
|
}
|
|
63164
63116
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63165
63117
|
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
63166
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter,
|
|
63167
|
-
function
|
|
63118
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker2, reportUnreliableMapper);
|
|
63119
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
63168
63120
|
return isRelatedTo(
|
|
63169
63121
|
source3,
|
|
63170
63122
|
target3,
|
|
63171
|
-
intersectionState,
|
|
63172
63123
|
3 /* Both */,
|
|
63173
63124
|
reportErrors3,
|
|
63174
63125
|
/*headMessage*/
|
|
63175
|
-
void 0
|
|
63126
|
+
void 0,
|
|
63127
|
+
intersectionState
|
|
63176
63128
|
);
|
|
63177
63129
|
}
|
|
63178
63130
|
}
|
|
63179
|
-
function signaturesIdenticalTo(source2, target2, kind
|
|
63131
|
+
function signaturesIdenticalTo(source2, target2, kind) {
|
|
63180
63132
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
63181
63133
|
const targetSignatures = getSignaturesOfType(target2, kind);
|
|
63182
63134
|
if (sourceSignatures.length !== targetSignatures.length) {
|
|
@@ -63193,7 +63145,7 @@ function createTypeChecker(host) {
|
|
|
63193
63145
|
false,
|
|
63194
63146
|
/*ignoreReturnTypes*/
|
|
63195
63147
|
false,
|
|
63196
|
-
|
|
63148
|
+
isRelatedTo
|
|
63197
63149
|
);
|
|
63198
63150
|
if (!related) {
|
|
63199
63151
|
return 0 /* False */;
|
|
@@ -63201,9 +63153,6 @@ function createTypeChecker(host) {
|
|
|
63201
63153
|
result2 &= related;
|
|
63202
63154
|
}
|
|
63203
63155
|
return result2;
|
|
63204
|
-
function isRelatedToWorker(source3, target3) {
|
|
63205
|
-
return isRelatedTo(source3, target3, intersectionState);
|
|
63206
|
-
}
|
|
63207
63156
|
}
|
|
63208
63157
|
function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
63209
63158
|
let result2 = -1 /* True */;
|
|
@@ -63219,11 +63168,11 @@ function createTypeChecker(host) {
|
|
|
63219
63168
|
const related = isRelatedTo(
|
|
63220
63169
|
type,
|
|
63221
63170
|
targetInfo.type,
|
|
63222
|
-
intersectionState,
|
|
63223
63171
|
3 /* Both */,
|
|
63224
63172
|
reportErrors2,
|
|
63225
63173
|
/*headMessage*/
|
|
63226
|
-
void 0
|
|
63174
|
+
void 0,
|
|
63175
|
+
intersectionState
|
|
63227
63176
|
);
|
|
63228
63177
|
if (!related) {
|
|
63229
63178
|
if (reportErrors2) {
|
|
@@ -63249,11 +63198,11 @@ function createTypeChecker(host) {
|
|
|
63249
63198
|
const related = isRelatedTo(
|
|
63250
63199
|
sourceInfo.type,
|
|
63251
63200
|
targetInfo.type,
|
|
63252
|
-
intersectionState,
|
|
63253
63201
|
3 /* Both */,
|
|
63254
63202
|
reportErrors2,
|
|
63255
63203
|
/*headMessage*/
|
|
63256
|
-
void 0
|
|
63204
|
+
void 0,
|
|
63205
|
+
intersectionState
|
|
63257
63206
|
);
|
|
63258
63207
|
if (!related && reportErrors2) {
|
|
63259
63208
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
@@ -63266,13 +63215,13 @@ function createTypeChecker(host) {
|
|
|
63266
63215
|
}
|
|
63267
63216
|
function indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportErrors2, intersectionState) {
|
|
63268
63217
|
if (relation === identityRelation) {
|
|
63269
|
-
return indexSignaturesIdenticalTo(source2, target2
|
|
63218
|
+
return indexSignaturesIdenticalTo(source2, target2);
|
|
63270
63219
|
}
|
|
63271
63220
|
const indexInfos = getIndexInfosOfType(target2);
|
|
63272
63221
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
63273
63222
|
let result2 = -1 /* True */;
|
|
63274
63223
|
for (const targetInfo of indexInfos) {
|
|
63275
|
-
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type,
|
|
63224
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63276
63225
|
if (!related) {
|
|
63277
63226
|
return 0 /* False */;
|
|
63278
63227
|
}
|
|
@@ -63293,7 +63242,7 @@ function createTypeChecker(host) {
|
|
|
63293
63242
|
}
|
|
63294
63243
|
return 0 /* False */;
|
|
63295
63244
|
}
|
|
63296
|
-
function indexSignaturesIdenticalTo(source2, target2
|
|
63245
|
+
function indexSignaturesIdenticalTo(source2, target2) {
|
|
63297
63246
|
const sourceInfos = getIndexInfosOfType(source2);
|
|
63298
63247
|
const targetInfos = getIndexInfosOfType(target2);
|
|
63299
63248
|
if (sourceInfos.length !== targetInfos.length) {
|
|
@@ -63301,7 +63250,7 @@ function createTypeChecker(host) {
|
|
|
63301
63250
|
}
|
|
63302
63251
|
for (const targetInfo of targetInfos) {
|
|
63303
63252
|
const sourceInfo = getIndexInfoOfType(source2, targetInfo.keyType);
|
|
63304
|
-
if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type,
|
|
63253
|
+
if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
|
|
63305
63254
|
return 0 /* False */;
|
|
63306
63255
|
}
|
|
63307
63256
|
}
|
|
@@ -67156,7 +67105,7 @@ function createTypeChecker(host) {
|
|
|
67156
67105
|
if (!hasDefaultClause) {
|
|
67157
67106
|
return caseType;
|
|
67158
67107
|
}
|
|
67159
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
67108
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
67160
67109
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
67161
67110
|
}
|
|
67162
67111
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -83211,9 +83160,23 @@ function createTypeChecker(host) {
|
|
|
83211
83160
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83212
83161
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
83213
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
|
+
}
|
|
83214
83178
|
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
83215
|
-
|
|
83216
|
-
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;
|
|
83217
83180
|
}
|
|
83218
83181
|
function getSingleReturnExpression(declaration) {
|
|
83219
83182
|
let candidateExpr;
|
|
@@ -83398,6 +83361,35 @@ function createTypeChecker(host) {
|
|
|
83398
83361
|
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
|
83399
83362
|
}
|
|
83400
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
|
+
}
|
|
83401
83393
|
function createResolver() {
|
|
83402
83394
|
return {
|
|
83403
83395
|
getReferencedExportContainer,
|
|
@@ -83451,34 +83443,19 @@ function createTypeChecker(host) {
|
|
|
83451
83443
|
},
|
|
83452
83444
|
getJsxFactoryEntity,
|
|
83453
83445
|
getJsxFragmentFactoryEntity,
|
|
83454
|
-
getAllAccessorDeclarations(accessor) {
|
|
83455
|
-
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83456
|
-
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83457
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83458
|
-
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83459
|
-
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83460
|
-
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83461
|
-
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83462
|
-
return {
|
|
83463
|
-
firstAccessor,
|
|
83464
|
-
secondAccessor,
|
|
83465
|
-
setAccessor,
|
|
83466
|
-
getAccessor
|
|
83467
|
-
};
|
|
83468
|
-
},
|
|
83469
83446
|
isBindingCapturedByNode: (node, decl) => {
|
|
83470
83447
|
const parseNode = getParseTreeNode(node);
|
|
83471
83448
|
const parseDecl = getParseTreeNode(decl);
|
|
83472
83449
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
83473
83450
|
},
|
|
83474
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker
|
|
83451
|
+
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
83475
83452
|
const n = getParseTreeNode(node);
|
|
83476
83453
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
83477
83454
|
const sym = getSymbolOfDeclaration(node);
|
|
83478
83455
|
if (!sym) {
|
|
83479
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker
|
|
83456
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
83480
83457
|
}
|
|
83481
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker
|
|
83458
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
83482
83459
|
},
|
|
83483
83460
|
isImportRequiredByAugmentation
|
|
83484
83461
|
};
|
|
@@ -83820,7 +83797,7 @@ function createTypeChecker(host) {
|
|
|
83820
83797
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
|
|
83821
83798
|
}
|
|
83822
83799
|
} else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
|
|
83823
|
-
const accessors =
|
|
83800
|
+
const accessors = getAllAccessorDeclarationsForDeclaration(node);
|
|
83824
83801
|
if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
|
|
83825
83802
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
83826
83803
|
}
|
|
@@ -89011,7 +88988,7 @@ function transformTypeScript(context) {
|
|
|
89011
88988
|
if (typeSerializer) {
|
|
89012
88989
|
let decorators;
|
|
89013
88990
|
if (shouldAddTypeMetadata(node)) {
|
|
89014
|
-
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));
|
|
89015
88992
|
decorators = append(decorators, factory2.createDecorator(typeMetadata));
|
|
89016
88993
|
}
|
|
89017
88994
|
if (shouldAddParamTypesMetadata(node)) {
|
|
@@ -89038,7 +89015,7 @@ function transformTypeScript(context) {
|
|
|
89038
89015
|
/*type*/
|
|
89039
89016
|
void 0,
|
|
89040
89017
|
factory2.createToken(39 /* EqualsGreaterThanToken */),
|
|
89041
|
-
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
|
|
89018
|
+
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
|
|
89042
89019
|
));
|
|
89043
89020
|
properties = append(properties, typeProperty);
|
|
89044
89021
|
}
|
|
@@ -92475,7 +92452,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92475
92452
|
let currentNameScope;
|
|
92476
92453
|
return {
|
|
92477
92454
|
serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
|
|
92478
|
-
serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
|
|
92455
|
+
serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
|
|
92479
92456
|
serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
|
|
92480
92457
|
serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
|
|
92481
92458
|
};
|
|
@@ -92489,18 +92466,18 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92489
92466
|
currentNameScope = savedCurrentNameScope;
|
|
92490
92467
|
return result;
|
|
92491
92468
|
}
|
|
92492
|
-
function getAccessorTypeNode(node) {
|
|
92493
|
-
const accessors =
|
|
92469
|
+
function getAccessorTypeNode(node, container) {
|
|
92470
|
+
const accessors = getAllAccessorDeclarations(container.members, node);
|
|
92494
92471
|
return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
|
|
92495
92472
|
}
|
|
92496
|
-
function serializeTypeOfNode(node) {
|
|
92473
|
+
function serializeTypeOfNode(node, container) {
|
|
92497
92474
|
switch (node.kind) {
|
|
92498
92475
|
case 172 /* PropertyDeclaration */:
|
|
92499
92476
|
case 169 /* Parameter */:
|
|
92500
92477
|
return serializeTypeNode(node.type);
|
|
92501
92478
|
case 178 /* SetAccessor */:
|
|
92502
92479
|
case 177 /* GetAccessor */:
|
|
92503
|
-
return serializeTypeNode(getAccessorTypeNode(node));
|
|
92480
|
+
return serializeTypeNode(getAccessorTypeNode(node, container));
|
|
92504
92481
|
case 263 /* ClassDeclaration */:
|
|
92505
92482
|
case 231 /* ClassExpression */:
|
|
92506
92483
|
case 174 /* MethodDeclaration */:
|
|
@@ -92523,7 +92500,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92523
92500
|
if (parameter.dotDotDotToken) {
|
|
92524
92501
|
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
|
92525
92502
|
} else {
|
|
92526
|
-
expressions.push(serializeTypeOfNode(parameter));
|
|
92503
|
+
expressions.push(serializeTypeOfNode(parameter, container));
|
|
92527
92504
|
}
|
|
92528
92505
|
}
|
|
92529
92506
|
}
|
|
@@ -108550,13 +108527,13 @@ function transformDeclarations(context) {
|
|
|
108550
108527
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108551
108528
|
}
|
|
108552
108529
|
}
|
|
108553
|
-
function transformDeclarationsForJS(sourceFile
|
|
108530
|
+
function transformDeclarationsForJS(sourceFile) {
|
|
108554
108531
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108555
108532
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
108556
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,
|
|
108557
108534
|
errorNode: s.errorNode || sourceFile
|
|
108558
108535
|
};
|
|
108559
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker
|
|
108536
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108560
108537
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108561
108538
|
return result;
|
|
108562
108539
|
}
|
|
@@ -108587,11 +108564,7 @@ function transformDeclarations(context) {
|
|
|
108587
108564
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
108588
108565
|
resultHasExternalModuleIndicator = false;
|
|
108589
108566
|
needsDeclare = false;
|
|
108590
|
-
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(
|
|
108591
|
-
sourceFile,
|
|
108592
|
-
/*bundled*/
|
|
108593
|
-
true
|
|
108594
|
-
)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108567
|
+
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108595
108568
|
const newFile = factory2.updateSourceFile(
|
|
108596
108569
|
sourceFile,
|
|
108597
108570
|
[factory2.createModuleDeclaration(
|
|
@@ -108913,7 +108886,7 @@ function transformDeclarations(context) {
|
|
|
108913
108886
|
if (!isPrivate) {
|
|
108914
108887
|
const valueParameter = getSetAccessorValueParameter(input);
|
|
108915
108888
|
if (valueParameter) {
|
|
108916
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
108889
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
108917
108890
|
newValueParameter = ensureParameter(
|
|
108918
108891
|
valueParameter,
|
|
108919
108892
|
/*modifierMask*/
|
|
@@ -109199,7 +109172,7 @@ function transformDeclarations(context) {
|
|
|
109199
109172
|
void 0
|
|
109200
109173
|
);
|
|
109201
109174
|
}
|
|
109202
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
109175
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
109203
109176
|
return cleanup(factory2.updateGetAccessorDeclaration(
|
|
109204
109177
|
input,
|
|
109205
109178
|
ensureModifiers(input),
|
|
@@ -111047,7 +111020,6 @@ var notImplementedResolver = {
|
|
|
111047
111020
|
isLiteralConstDeclaration: notImplemented,
|
|
111048
111021
|
getJsxFactoryEntity: notImplemented,
|
|
111049
111022
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
111050
|
-
getAllAccessorDeclarations: notImplemented,
|
|
111051
111023
|
isBindingCapturedByNode: notImplemented,
|
|
111052
111024
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
111053
111025
|
isImportRequiredByAugmentation: notImplemented
|