@typescript-deploys/pr-build 5.5.0-pr-57996-3 → 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 +53 -88
- package/lib/typescript.js +53 -88
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -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;
|
|
@@ -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
49861
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49871
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined
|
|
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,14 +49892,14 @@ 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) {
|
|
@@ -49917,7 +49908,7 @@ function createTypeChecker(host) {
|
|
|
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*/
|
|
@@ -67125,7 +67105,7 @@ function createTypeChecker(host) {
|
|
|
67125
67105
|
if (!hasDefaultClause) {
|
|
67126
67106
|
return caseType;
|
|
67127
67107
|
}
|
|
67128
|
-
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)))));
|
|
67129
67109
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
67130
67110
|
}
|
|
67131
67111
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -71216,7 +71196,7 @@ function createTypeChecker(host) {
|
|
|
71216
71196
|
if (isErrorType(objectType) || objectType === silentNeverType) {
|
|
71217
71197
|
return objectType;
|
|
71218
71198
|
}
|
|
71219
|
-
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)
|
|
71199
|
+
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
71220
71200
|
error(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
71221
71201
|
return errorType;
|
|
71222
71202
|
}
|
|
@@ -76260,28 +76240,17 @@ function createTypeChecker(host) {
|
|
|
76260
76240
|
}
|
|
76261
76241
|
function checkConstEnumAccess(node, type) {
|
|
76262
76242
|
const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */;
|
|
76263
|
-
if (!ok
|
|
76264
|
-
|
|
76265
|
-
if (!ok) {
|
|
76266
|
-
error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
76267
|
-
} else if (type.symbol.valueDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76268
|
-
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76269
|
-
}
|
|
76270
|
-
}
|
|
76243
|
+
if (!ok) {
|
|
76244
|
+
error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
76271
76245
|
}
|
|
76272
|
-
|
|
76273
|
-
|
|
76274
|
-
|
|
76275
|
-
|
|
76276
|
-
|
|
76277
|
-
|
|
76278
|
-
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(use)) {
|
|
76279
|
-
return false;
|
|
76246
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
76247
|
+
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76248
|
+
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76249
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
|
|
76250
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
|
|
76251
|
+
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76280
76252
|
}
|
|
76281
|
-
return shouldPreserveConstEnums(compilerOptions);
|
|
76282
76253
|
}
|
|
76283
|
-
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(otherFile.resolvedPath);
|
|
76284
|
-
return redirect && shouldPreserveConstEnums(redirect.commandLine.options);
|
|
76285
76254
|
}
|
|
76286
76255
|
function checkParenthesizedExpression(node, checkMode) {
|
|
76287
76256
|
if (hasJSDocNodes(node)) {
|
|
@@ -83479,14 +83448,14 @@ function createTypeChecker(host) {
|
|
|
83479
83448
|
const parseDecl = getParseTreeNode(decl);
|
|
83480
83449
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
83481
83450
|
},
|
|
83482
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker
|
|
83451
|
+
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
83483
83452
|
const n = getParseTreeNode(node);
|
|
83484
83453
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
83485
83454
|
const sym = getSymbolOfDeclaration(node);
|
|
83486
83455
|
if (!sym) {
|
|
83487
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker
|
|
83456
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
83488
83457
|
}
|
|
83489
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker
|
|
83458
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
83490
83459
|
},
|
|
83491
83460
|
isImportRequiredByAugmentation
|
|
83492
83461
|
};
|
|
@@ -108558,13 +108527,13 @@ function transformDeclarations(context) {
|
|
|
108558
108527
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108559
108528
|
}
|
|
108560
108529
|
}
|
|
108561
|
-
function transformDeclarationsForJS(sourceFile
|
|
108530
|
+
function transformDeclarationsForJS(sourceFile) {
|
|
108562
108531
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108563
108532
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
108564
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,
|
|
108565
108534
|
errorNode: s.errorNode || sourceFile
|
|
108566
108535
|
};
|
|
108567
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker
|
|
108536
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108568
108537
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108569
108538
|
return result;
|
|
108570
108539
|
}
|
|
@@ -108595,11 +108564,7 @@ function transformDeclarations(context) {
|
|
|
108595
108564
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
108596
108565
|
resultHasExternalModuleIndicator = false;
|
|
108597
108566
|
needsDeclare = false;
|
|
108598
|
-
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(
|
|
108599
|
-
sourceFile,
|
|
108600
|
-
/*bundled*/
|
|
108601
|
-
true
|
|
108602
|
-
)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108567
|
+
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108603
108568
|
const newFile = factory2.updateSourceFile(
|
|
108604
108569
|
sourceFile,
|
|
108605
108570
|
[factory2.createModuleDeclaration(
|
package/lib/typescript.js
CHANGED
|
@@ -52731,17 +52731,7 @@ function createTypeChecker(host) {
|
|
|
52731
52731
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
52732
52732
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
52733
52733
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
52734
|
-
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
52735
|
-
context,
|
|
52736
|
-
type,
|
|
52737
|
-
symbol,
|
|
52738
|
-
enclosingDeclaration,
|
|
52739
|
-
/*includePrivateSymbol*/
|
|
52740
|
-
void 0,
|
|
52741
|
-
/*bundled*/
|
|
52742
|
-
void 0,
|
|
52743
|
-
addUndefined
|
|
52744
|
-
)),
|
|
52734
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
|
|
52745
52735
|
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
52746
52736
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
52747
52737
|
indexInfo,
|
|
@@ -52761,7 +52751,7 @@ function createTypeChecker(host) {
|
|
|
52761
52751
|
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
52762
52752
|
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
52763
52753
|
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
52764
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker
|
|
52754
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
52765
52755
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
52766
52756
|
};
|
|
52767
52757
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
@@ -52779,12 +52769,12 @@ function createTypeChecker(host) {
|
|
|
52779
52769
|
}
|
|
52780
52770
|
return typeToTypeNodeHelper(type, context);
|
|
52781
52771
|
}
|
|
52782
|
-
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined
|
|
52772
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
52783
52773
|
const originalType = type;
|
|
52784
52774
|
if (addUndefined) {
|
|
52785
52775
|
type = getOptionalType(type);
|
|
52786
52776
|
}
|
|
52787
|
-
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2
|
|
52777
|
+
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
52788
52778
|
if (clone2) {
|
|
52789
52779
|
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
52790
52780
|
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
@@ -52792,16 +52782,16 @@ function createTypeChecker(host) {
|
|
|
52792
52782
|
return clone2;
|
|
52793
52783
|
}
|
|
52794
52784
|
if (addUndefined && originalType !== type) {
|
|
52795
|
-
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2
|
|
52785
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2);
|
|
52796
52786
|
if (cloneMissingUndefined) {
|
|
52797
52787
|
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
52798
52788
|
}
|
|
52799
52789
|
}
|
|
52800
52790
|
return void 0;
|
|
52801
52791
|
}
|
|
52802
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration,
|
|
52792
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
|
|
52803
52793
|
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
52804
|
-
const result = tryReuseExistingTypeNodeHelper(context, existing
|
|
52794
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
52805
52795
|
if (result) {
|
|
52806
52796
|
return result;
|
|
52807
52797
|
}
|
|
@@ -52836,7 +52826,8 @@ function createTypeChecker(host) {
|
|
|
52836
52826
|
symbolDepth: void 0,
|
|
52837
52827
|
inferTypeParameters: void 0,
|
|
52838
52828
|
approximateLength: 0,
|
|
52839
|
-
trackedSymbols: void 0
|
|
52829
|
+
trackedSymbols: void 0,
|
|
52830
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
52840
52831
|
};
|
|
52841
52832
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
52842
52833
|
const resultingNode = cb(context);
|
|
@@ -53904,13 +53895,13 @@ function createTypeChecker(host) {
|
|
|
53904
53895
|
);
|
|
53905
53896
|
}
|
|
53906
53897
|
}
|
|
53907
|
-
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
|
|
53898
|
+
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 */));
|
|
53908
53899
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
53909
53900
|
if (thisParameter) {
|
|
53910
53901
|
parameters.unshift(thisParameter);
|
|
53911
53902
|
}
|
|
53912
53903
|
context.flags = flags;
|
|
53913
|
-
const returnTypeNode = serializeReturnTypeForSignature(context, signature
|
|
53904
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
53914
53905
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
53915
53906
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
53916
53907
|
const flags2 = modifiersToFlags(modifiers);
|
|
@@ -54043,11 +54034,11 @@ function createTypeChecker(host) {
|
|
|
54043
54034
|
return getDeclarationOfKind(parameterSymbol, 341 /* JSDocParameterTag */);
|
|
54044
54035
|
}
|
|
54045
54036
|
}
|
|
54046
|
-
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags
|
|
54037
|
+
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
54047
54038
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
54048
54039
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
54049
54040
|
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
54050
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration,
|
|
54041
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
54051
54042
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
54052
54043
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
54053
54044
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -54627,13 +54618,13 @@ function createTypeChecker(host) {
|
|
|
54627
54618
|
}
|
|
54628
54619
|
return enclosingDeclaration;
|
|
54629
54620
|
}
|
|
54630
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration,
|
|
54621
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
|
|
54631
54622
|
var _a;
|
|
54632
54623
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
54633
54624
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
54634
54625
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
54635
54626
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
54636
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined
|
|
54627
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
54637
54628
|
if (result2) {
|
|
54638
54629
|
return result2;
|
|
54639
54630
|
}
|
|
@@ -54658,7 +54649,7 @@ function createTypeChecker(host) {
|
|
|
54658
54649
|
}
|
|
54659
54650
|
return false;
|
|
54660
54651
|
}
|
|
54661
|
-
function serializeReturnTypeForSignature(context, signature
|
|
54652
|
+
function serializeReturnTypeForSignature(context, signature) {
|
|
54662
54653
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
54663
54654
|
const flags = context.flags;
|
|
54664
54655
|
if (suppressAny)
|
|
@@ -54666,14 +54657,14 @@ function createTypeChecker(host) {
|
|
|
54666
54657
|
let returnTypeNode;
|
|
54667
54658
|
const returnType = getReturnTypeOfSignature(signature);
|
|
54668
54659
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
54669
|
-
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature
|
|
54660
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
54670
54661
|
} else if (!suppressAny) {
|
|
54671
54662
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
54672
54663
|
}
|
|
54673
54664
|
context.flags = flags;
|
|
54674
54665
|
return returnTypeNode;
|
|
54675
54666
|
}
|
|
54676
|
-
function serializeReturnTypeForSignatureWorker(context, signature
|
|
54667
|
+
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
54677
54668
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
54678
54669
|
const type = getReturnTypeOfSignature(signature);
|
|
54679
54670
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
@@ -54682,7 +54673,7 @@ function createTypeChecker(host) {
|
|
|
54682
54673
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
54683
54674
|
const annotated = getTypeFromTypeNode(annotation);
|
|
54684
54675
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
54685
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration,
|
|
54676
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
54686
54677
|
if (result) {
|
|
54687
54678
|
return result;
|
|
54688
54679
|
}
|
|
@@ -54694,7 +54685,7 @@ function createTypeChecker(host) {
|
|
|
54694
54685
|
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
54695
54686
|
return expressionOrTypeToTypeNode(context, expr, type);
|
|
54696
54687
|
}
|
|
54697
|
-
function trackExistingEntityName(node, context
|
|
54688
|
+
function trackExistingEntityName(node, context) {
|
|
54698
54689
|
let introducesError = false;
|
|
54699
54690
|
const leftmost = getFirstIdentifier(node);
|
|
54700
54691
|
if (isInJSFile(node) && (isExportsIdentifier(leftmost) || isModuleExportsAccessExpression(leftmost.parent) || isQualifiedName(leftmost.parent) && isModuleIdentifier(leftmost.parent.left) && isExportsIdentifier(leftmost.parent.right))) {
|
|
@@ -54723,7 +54714,6 @@ function createTypeChecker(host) {
|
|
|
54723
54714
|
}
|
|
54724
54715
|
} else {
|
|
54725
54716
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
54726
|
-
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
54727
54717
|
}
|
|
54728
54718
|
if (isIdentifier(node)) {
|
|
54729
54719
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
@@ -54734,7 +54724,7 @@ function createTypeChecker(host) {
|
|
|
54734
54724
|
}
|
|
54735
54725
|
return { introducesError, node };
|
|
54736
54726
|
}
|
|
54737
|
-
function tryReuseExistingTypeNodeHelper(context, existing
|
|
54727
|
+
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
54738
54728
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
54739
54729
|
cancellationToken.throwIfCancellationRequested();
|
|
54740
54730
|
}
|
|
@@ -54877,7 +54867,7 @@ function createTypeChecker(host) {
|
|
|
54877
54867
|
return visited;
|
|
54878
54868
|
}
|
|
54879
54869
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
54880
|
-
const { introducesError, node: result } = trackExistingEntityName(node, context
|
|
54870
|
+
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
54881
54871
|
hadError = hadError || introducesError;
|
|
54882
54872
|
if (result !== node) {
|
|
54883
54873
|
return result;
|
|
@@ -54908,7 +54898,7 @@ function createTypeChecker(host) {
|
|
|
54908
54898
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
54909
54899
|
}
|
|
54910
54900
|
function rewriteModuleSpecifier(parent2, lit) {
|
|
54911
|
-
if (bundled) {
|
|
54901
|
+
if (context.bundled) {
|
|
54912
54902
|
if (context.tracker && context.tracker.moduleResolverHost) {
|
|
54913
54903
|
const targetFile = getExternalModuleFileFromDeclaration(parent2);
|
|
54914
54904
|
if (targetFile) {
|
|
@@ -54927,7 +54917,7 @@ function createTypeChecker(host) {
|
|
|
54927
54917
|
}
|
|
54928
54918
|
}
|
|
54929
54919
|
}
|
|
54930
|
-
function symbolTableToDeclarationStatements(symbolTable, context
|
|
54920
|
+
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
54931
54921
|
var _a;
|
|
54932
54922
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
54933
54923
|
factory.createPropertyDeclaration,
|
|
@@ -54986,7 +54976,7 @@ function createTypeChecker(host) {
|
|
|
54986
54976
|
const baseName = unescapeLeadingUnderscores(name);
|
|
54987
54977
|
void getInternalSymbolName(symbol, baseName);
|
|
54988
54978
|
});
|
|
54989
|
-
let addingDeclare = !bundled;
|
|
54979
|
+
let addingDeclare = !context.bundled;
|
|
54990
54980
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
54991
54981
|
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
54992
54982
|
symbolTable = createSymbolTable();
|
|
@@ -55267,7 +55257,7 @@ function createTypeChecker(host) {
|
|
|
55267
55257
|
name,
|
|
55268
55258
|
/*exclamationToken*/
|
|
55269
55259
|
void 0,
|
|
55270
|
-
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration
|
|
55260
|
+
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
|
|
55271
55261
|
)
|
|
55272
55262
|
], flags)
|
|
55273
55263
|
),
|
|
@@ -55409,9 +55399,7 @@ function createTypeChecker(host) {
|
|
|
55409
55399
|
jsdocAliasDecl.typeExpression.type,
|
|
55410
55400
|
aliasType,
|
|
55411
55401
|
/*host*/
|
|
55412
|
-
void 0
|
|
55413
|
-
includePrivateSymbol,
|
|
55414
|
-
bundled
|
|
55402
|
+
void 0
|
|
55415
55403
|
) || typeToTypeNodeHelper(aliasType, context);
|
|
55416
55404
|
addResult(
|
|
55417
55405
|
setSyntheticLeadingComments(
|
|
@@ -55541,7 +55529,7 @@ function createTypeChecker(host) {
|
|
|
55541
55529
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
55542
55530
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
55543
55531
|
for (const sig of signatures) {
|
|
55544
|
-
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName)
|
|
55532
|
+
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
55545
55533
|
addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
55546
55534
|
}
|
|
55547
55535
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
@@ -55635,7 +55623,7 @@ function createTypeChecker(host) {
|
|
|
55635
55623
|
);
|
|
55636
55624
|
}
|
|
55637
55625
|
let introducesError;
|
|
55638
|
-
({ introducesError, node: expr } = trackExistingEntityName(expr, context
|
|
55626
|
+
({ introducesError, node: expr } = trackExistingEntityName(expr, context));
|
|
55639
55627
|
if (introducesError) {
|
|
55640
55628
|
return cleanup(
|
|
55641
55629
|
/*result*/
|
|
@@ -55645,15 +55633,7 @@ function createTypeChecker(host) {
|
|
|
55645
55633
|
}
|
|
55646
55634
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
55647
55635
|
expr,
|
|
55648
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
55649
|
-
context,
|
|
55650
|
-
a,
|
|
55651
|
-
getTypeFromTypeNode(a),
|
|
55652
|
-
/*host*/
|
|
55653
|
-
void 0,
|
|
55654
|
-
includePrivateSymbol,
|
|
55655
|
-
bundled
|
|
55656
|
-
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
55636
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
55657
55637
|
));
|
|
55658
55638
|
function cleanup(result2) {
|
|
55659
55639
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -55878,7 +55858,7 @@ function createTypeChecker(host) {
|
|
|
55878
55858
|
break;
|
|
55879
55859
|
case 273 /* ImportClause */: {
|
|
55880
55860
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55881
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
55861
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
55882
55862
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
55883
55863
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
55884
55864
|
addResult(
|
|
@@ -55900,7 +55880,7 @@ function createTypeChecker(host) {
|
|
|
55900
55880
|
}
|
|
55901
55881
|
case 274 /* NamespaceImport */: {
|
|
55902
55882
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55903
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
55883
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
55904
55884
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
55905
55885
|
addResult(
|
|
55906
55886
|
factory.createImportDeclaration(
|
|
@@ -55934,7 +55914,7 @@ function createTypeChecker(host) {
|
|
|
55934
55914
|
break;
|
|
55935
55915
|
case 276 /* ImportSpecifier */: {
|
|
55936
55916
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55937
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
55917
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
55938
55918
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
55939
55919
|
addResult(
|
|
55940
55920
|
factory.createImportDeclaration(
|
|
@@ -56088,7 +56068,7 @@ function createTypeChecker(host) {
|
|
|
56088
56068
|
varName,
|
|
56089
56069
|
/*exclamationToken*/
|
|
56090
56070
|
void 0,
|
|
56091
|
-
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration
|
|
56071
|
+
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
|
|
56092
56072
|
)
|
|
56093
56073
|
], flags)
|
|
56094
56074
|
);
|
|
@@ -56172,7 +56152,7 @@ function createTypeChecker(host) {
|
|
|
56172
56152
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
56173
56153
|
/*questionToken*/
|
|
56174
56154
|
void 0,
|
|
56175
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
56155
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
|
|
56176
56156
|
)],
|
|
56177
56157
|
/*body*/
|
|
56178
56158
|
void 0
|
|
@@ -56187,7 +56167,7 @@ function createTypeChecker(host) {
|
|
|
56187
56167
|
factory.createModifiersFromModifierFlags(flag),
|
|
56188
56168
|
name,
|
|
56189
56169
|
[],
|
|
56190
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
56170
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
|
|
56191
56171
|
/*body*/
|
|
56192
56172
|
void 0
|
|
56193
56173
|
),
|
|
@@ -56201,7 +56181,7 @@ function createTypeChecker(host) {
|
|
|
56201
56181
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
56202
56182
|
name,
|
|
56203
56183
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
56204
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration
|
|
56184
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
|
|
56205
56185
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
56206
56186
|
// interface members can't have initializers, however class members _can_
|
|
56207
56187
|
/*initializer*/
|
|
@@ -71890,7 +71870,7 @@ function createTypeChecker(host) {
|
|
|
71890
71870
|
if (!hasDefaultClause) {
|
|
71891
71871
|
return caseType;
|
|
71892
71872
|
}
|
|
71893
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
71873
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
71894
71874
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
71895
71875
|
}
|
|
71896
71876
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -75981,7 +75961,7 @@ function createTypeChecker(host) {
|
|
|
75981
75961
|
if (isErrorType(objectType) || objectType === silentNeverType) {
|
|
75982
75962
|
return objectType;
|
|
75983
75963
|
}
|
|
75984
|
-
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)
|
|
75964
|
+
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
75985
75965
|
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
75986
75966
|
return errorType;
|
|
75987
75967
|
}
|
|
@@ -81025,28 +81005,17 @@ function createTypeChecker(host) {
|
|
|
81025
81005
|
}
|
|
81026
81006
|
function checkConstEnumAccess(node, type) {
|
|
81027
81007
|
const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */;
|
|
81028
|
-
if (!ok
|
|
81029
|
-
|
|
81030
|
-
if (!ok) {
|
|
81031
|
-
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
81032
|
-
} else if (type.symbol.valueDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
81033
|
-
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81034
|
-
}
|
|
81035
|
-
}
|
|
81008
|
+
if (!ok) {
|
|
81009
|
+
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
81036
81010
|
}
|
|
81037
|
-
|
|
81038
|
-
|
|
81039
|
-
|
|
81040
|
-
|
|
81041
|
-
|
|
81042
|
-
|
|
81043
|
-
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(use)) {
|
|
81044
|
-
return false;
|
|
81011
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
81012
|
+
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
81013
|
+
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
81014
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
|
|
81015
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
|
|
81016
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81045
81017
|
}
|
|
81046
|
-
return shouldPreserveConstEnums(compilerOptions);
|
|
81047
81018
|
}
|
|
81048
|
-
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(otherFile.resolvedPath);
|
|
81049
|
-
return redirect && shouldPreserveConstEnums(redirect.commandLine.options);
|
|
81050
81019
|
}
|
|
81051
81020
|
function checkParenthesizedExpression(node, checkMode) {
|
|
81052
81021
|
if (hasJSDocNodes(node)) {
|
|
@@ -88244,14 +88213,14 @@ function createTypeChecker(host) {
|
|
|
88244
88213
|
const parseDecl = getParseTreeNode(decl);
|
|
88245
88214
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
88246
88215
|
},
|
|
88247
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker
|
|
88216
|
+
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
88248
88217
|
const n = getParseTreeNode(node);
|
|
88249
88218
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
88250
88219
|
const sym = getSymbolOfDeclaration(node);
|
|
88251
88220
|
if (!sym) {
|
|
88252
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker
|
|
88221
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
88253
88222
|
}
|
|
88254
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker
|
|
88223
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
88255
88224
|
},
|
|
88256
88225
|
isImportRequiredByAugmentation
|
|
88257
88226
|
};
|
|
@@ -113510,13 +113479,13 @@ function transformDeclarations(context) {
|
|
|
113510
113479
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
113511
113480
|
}
|
|
113512
113481
|
}
|
|
113513
|
-
function transformDeclarationsForJS(sourceFile
|
|
113482
|
+
function transformDeclarationsForJS(sourceFile) {
|
|
113514
113483
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
113515
113484
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
113516
113485
|
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,
|
|
113517
113486
|
errorNode: s.errorNode || sourceFile
|
|
113518
113487
|
};
|
|
113519
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker
|
|
113488
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
113520
113489
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
113521
113490
|
return result;
|
|
113522
113491
|
}
|
|
@@ -113547,11 +113516,7 @@ function transformDeclarations(context) {
|
|
|
113547
113516
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
113548
113517
|
resultHasExternalModuleIndicator = false;
|
|
113549
113518
|
needsDeclare = false;
|
|
113550
|
-
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(
|
|
113551
|
-
sourceFile,
|
|
113552
|
-
/*bundled*/
|
|
113553
|
-
true
|
|
113554
|
-
)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
113519
|
+
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
113555
113520
|
const newFile = factory2.updateSourceFile(
|
|
113556
113521
|
sourceFile,
|
|
113557
113522
|
[factory2.createModuleDeclaration(
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-58001-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "c587a39dc52760240ee6b48758eb1e90660fef54"
|
|
117
117
|
}
|