typescript 5.6.0-dev.20240807 → 5.6.0-dev.20240809
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 +122 -90
- package/lib/typescript.js +186 -125
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -96,6 +96,7 @@ __export(typescript_exports, {
|
|
|
96
96
|
InlayHintKind: () => InlayHintKind2,
|
|
97
97
|
InlayHints: () => ts_InlayHints_exports,
|
|
98
98
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
99
|
+
InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
|
|
99
100
|
InternalSymbolName: () => InternalSymbolName,
|
|
100
101
|
IntersectionFlags: () => IntersectionFlags,
|
|
101
102
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
@@ -2260,7 +2261,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2260
2261
|
|
|
2261
2262
|
// src/compiler/corePublic.ts
|
|
2262
2263
|
var versionMajorMinor = "5.6";
|
|
2263
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2264
|
+
var version = `${versionMajorMinor}.0-dev.20240809`;
|
|
2264
2265
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2265
2266
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2266
2267
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6168,17 +6169,21 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
|
6168
6169
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple";
|
|
6169
6170
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
|
|
6170
6171
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
|
|
6171
|
-
NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps";
|
|
6172
|
-
NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
|
|
6173
6172
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
|
|
6174
|
-
NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
|
|
6175
|
-
NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedNames"] = 1] = "AllowUnresolvedNames";
|
|
6176
6173
|
NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
|
|
6177
6174
|
NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
|
|
6178
6175
|
NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
|
|
6179
6176
|
NodeBuilderFlags2[NodeBuilderFlags2["InInitialEntityName"] = 16777216] = "InInitialEntityName";
|
|
6180
6177
|
return NodeBuilderFlags2;
|
|
6181
6178
|
})(NodeBuilderFlags || {});
|
|
6179
|
+
var InternalNodeBuilderFlags = /* @__PURE__ */ ((InternalNodeBuilderFlags2) => {
|
|
6180
|
+
InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["None"] = 0] = "None";
|
|
6181
|
+
InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["WriteComputedProps"] = 1] = "WriteComputedProps";
|
|
6182
|
+
InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["NoSyntacticPrinter"] = 2] = "NoSyntacticPrinter";
|
|
6183
|
+
InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["DoNotIncludeSymbolChain"] = 4] = "DoNotIncludeSymbolChain";
|
|
6184
|
+
InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["AllowUnresolvedNames"] = 8] = "AllowUnresolvedNames";
|
|
6185
|
+
return InternalNodeBuilderFlags2;
|
|
6186
|
+
})(InternalNodeBuilderFlags || {});
|
|
6182
6187
|
var TypeFormatFlags = /* @__PURE__ */ ((TypeFormatFlags2) => {
|
|
6183
6188
|
TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None";
|
|
6184
6189
|
TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation";
|
|
@@ -25386,7 +25391,11 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25386
25391
|
node.modifiers = asNodeArray(modifiers);
|
|
25387
25392
|
node.parameters = createNodeArray(parameters);
|
|
25388
25393
|
node.body = body;
|
|
25389
|
-
|
|
25394
|
+
if (!node.body) {
|
|
25395
|
+
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
25396
|
+
} else {
|
|
25397
|
+
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
|
|
25398
|
+
}
|
|
25390
25399
|
node.typeParameters = void 0;
|
|
25391
25400
|
node.type = void 0;
|
|
25392
25401
|
node.typeArguments = void 0;
|
|
@@ -29555,7 +29564,7 @@ var asyncGeneratorHelper = {
|
|
|
29555
29564
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
29556
29565
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
29557
29566
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
29558
|
-
return i =
|
|
29567
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
29559
29568
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
29560
29569
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
29561
29570
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
@@ -29737,8 +29746,8 @@ var generatorHelper = {
|
|
|
29737
29746
|
priority: 6,
|
|
29738
29747
|
text: `
|
|
29739
29748
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
29740
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
29741
|
-
return g =
|
|
29749
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
29750
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29742
29751
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29743
29752
|
function step(op) {
|
|
29744
29753
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -53977,6 +53986,7 @@ function createTypeChecker(host) {
|
|
|
53977
53986
|
}
|
|
53978
53987
|
function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
|
|
53979
53988
|
let nodeFlags = 70221824 /* IgnoreErrors */;
|
|
53989
|
+
let internalNodeFlags = 0 /* None */;
|
|
53980
53990
|
if (flags & 2 /* UseOnlyExternalAliasing */) {
|
|
53981
53991
|
nodeFlags |= 128 /* UseOnlyExternalAliasing */;
|
|
53982
53992
|
}
|
|
@@ -53987,15 +53997,15 @@ function createTypeChecker(host) {
|
|
|
53987
53997
|
nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
53988
53998
|
}
|
|
53989
53999
|
if (flags & 32 /* DoNotIncludeSymbolChain */) {
|
|
53990
|
-
|
|
54000
|
+
internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
|
|
53991
54001
|
}
|
|
53992
54002
|
if (flags & 16 /* WriteComputedProps */) {
|
|
53993
|
-
|
|
54003
|
+
internalNodeFlags |= 1 /* WriteComputedProps */;
|
|
53994
54004
|
}
|
|
53995
54005
|
const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
|
|
53996
54006
|
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
|
|
53997
54007
|
function symbolToStringWorker(writer2) {
|
|
53998
|
-
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
|
|
54008
|
+
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
|
|
53999
54009
|
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
|
|
54000
54010
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
54001
54011
|
printer.writeNode(
|
|
@@ -54032,7 +54042,13 @@ function createTypeChecker(host) {
|
|
|
54032
54042
|
}
|
|
54033
54043
|
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
|
54034
54044
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
|
54035
|
-
const typeNode = nodeBuilder.typeToTypeNode(
|
|
54045
|
+
const typeNode = nodeBuilder.typeToTypeNode(
|
|
54046
|
+
type,
|
|
54047
|
+
enclosingDeclaration,
|
|
54048
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
|
|
54049
|
+
/*internalFlags*/
|
|
54050
|
+
void 0
|
|
54051
|
+
);
|
|
54036
54052
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
|
54037
54053
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
|
54038
54054
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -54081,31 +54097,31 @@ function createTypeChecker(host) {
|
|
|
54081
54097
|
}
|
|
54082
54098
|
function createNodeBuilder() {
|
|
54083
54099
|
return {
|
|
54084
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
54085
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
54086
|
-
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
54087
|
-
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
54088
|
-
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
54089
|
-
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
54100
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
54101
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
54102
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
54103
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
54104
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
54105
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
54090
54106
|
indexInfo,
|
|
54091
54107
|
context,
|
|
54092
54108
|
/*typeNode*/
|
|
54093
54109
|
void 0
|
|
54094
54110
|
)),
|
|
54095
|
-
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
54096
|
-
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToName(
|
|
54111
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
54112
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
|
|
54097
54113
|
symbol,
|
|
54098
54114
|
context,
|
|
54099
54115
|
meaning,
|
|
54100
54116
|
/*expectsIdentifier*/
|
|
54101
54117
|
false
|
|
54102
54118
|
)),
|
|
54103
|
-
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
54104
|
-
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
54105
|
-
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
54106
|
-
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
54107
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
54108
|
-
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
54119
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
54120
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
54121
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
54122
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
54123
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
54124
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
54109
54125
|
};
|
|
54110
54126
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
54111
54127
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
@@ -54127,13 +54143,13 @@ function createTypeChecker(host) {
|
|
|
54127
54143
|
return setTextRange(setOriginalNode(range, location), location);
|
|
54128
54144
|
}
|
|
54129
54145
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
54130
|
-
const
|
|
54131
|
-
if (expr && !(context.
|
|
54146
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
54147
|
+
if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
54132
54148
|
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
|
|
54133
54149
|
}
|
|
54134
|
-
context.
|
|
54150
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
54135
54151
|
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
|
|
54136
|
-
|
|
54152
|
+
restoreFlags();
|
|
54137
54153
|
return result;
|
|
54138
54154
|
}
|
|
54139
54155
|
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
|
|
@@ -54186,7 +54202,7 @@ function createTypeChecker(host) {
|
|
|
54186
54202
|
return void 0;
|
|
54187
54203
|
}
|
|
54188
54204
|
function symbolToNode(symbol, context, meaning) {
|
|
54189
|
-
if (context.
|
|
54205
|
+
if (context.internalFlags & 1 /* WriteComputedProps */) {
|
|
54190
54206
|
if (symbol.valueDeclaration) {
|
|
54191
54207
|
const name = getNameOfDeclaration(symbol.valueDeclaration);
|
|
54192
54208
|
if (name && isComputedPropertyName(name)) return name;
|
|
@@ -54199,12 +54215,13 @@ function createTypeChecker(host) {
|
|
|
54199
54215
|
}
|
|
54200
54216
|
return symbolToExpression(symbol, context, meaning);
|
|
54201
54217
|
}
|
|
54202
|
-
function withContext2(enclosingDeclaration, flags, tracker, cb) {
|
|
54203
|
-
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost :
|
|
54218
|
+
function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
|
54219
|
+
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
54204
54220
|
const context = {
|
|
54205
54221
|
enclosingDeclaration,
|
|
54206
54222
|
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
54207
54223
|
flags: flags || 0 /* None */,
|
|
54224
|
+
internalFlags: internalFlags || 0 /* None */,
|
|
54208
54225
|
tracker: void 0,
|
|
54209
54226
|
encounteredError: false,
|
|
54210
54227
|
reportedDiagnostic: false,
|
|
@@ -54234,14 +54251,23 @@ function createTypeChecker(host) {
|
|
|
54234
54251
|
}
|
|
54235
54252
|
return context.encounteredError ? void 0 : resultingNode;
|
|
54236
54253
|
}
|
|
54254
|
+
function saveRestoreFlags(context) {
|
|
54255
|
+
const flags = context.flags;
|
|
54256
|
+
const internalFlags = context.internalFlags;
|
|
54257
|
+
return restore;
|
|
54258
|
+
function restore() {
|
|
54259
|
+
context.flags = flags;
|
|
54260
|
+
context.internalFlags = internalFlags;
|
|
54261
|
+
}
|
|
54262
|
+
}
|
|
54237
54263
|
function checkTruncationLength(context) {
|
|
54238
54264
|
if (context.truncating) return context.truncating;
|
|
54239
54265
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
|
54240
54266
|
}
|
|
54241
54267
|
function typeToTypeNodeHelper(type, context) {
|
|
54242
|
-
const
|
|
54268
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
54243
54269
|
const typeNode = typeToTypeNodeWorker(type, context);
|
|
54244
|
-
|
|
54270
|
+
restoreFlags();
|
|
54245
54271
|
return typeNode;
|
|
54246
54272
|
}
|
|
54247
54273
|
function typeToTypeNodeWorker(type, context) {
|
|
@@ -54695,7 +54721,7 @@ function createTypeChecker(host) {
|
|
|
54695
54721
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
|
54696
54722
|
}
|
|
54697
54723
|
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
|
54698
|
-
const key = `${getTypeId(type2)}|${context.flags}`;
|
|
54724
|
+
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
|
54699
54725
|
if (links) {
|
|
54700
54726
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
54701
54727
|
}
|
|
@@ -54801,10 +54827,10 @@ function createTypeChecker(host) {
|
|
|
54801
54827
|
}
|
|
54802
54828
|
return typeToTypeNodeHelper(getIntersectionType(types), context);
|
|
54803
54829
|
}
|
|
54804
|
-
const
|
|
54830
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
54805
54831
|
context.flags |= 4194304 /* InObjectTypeLiteral */;
|
|
54806
54832
|
const members = createTypeNodesFromResolvedType(resolved);
|
|
54807
|
-
|
|
54833
|
+
restoreFlags();
|
|
54808
54834
|
const typeLiteralNode = factory.createTypeLiteralNode(members);
|
|
54809
54835
|
context.approximateLength += 2;
|
|
54810
54836
|
setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
|
|
@@ -54867,10 +54893,10 @@ function createTypeChecker(host) {
|
|
|
54867
54893
|
} while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent2);
|
|
54868
54894
|
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
|
|
54869
54895
|
const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
|
|
54870
|
-
const
|
|
54896
|
+
const restoreFlags2 = saveRestoreFlags(context);
|
|
54871
54897
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
54872
54898
|
const ref = symbolToTypeNode(parent2, context, 788968 /* Type */, typeArgumentSlice);
|
|
54873
|
-
|
|
54899
|
+
restoreFlags2();
|
|
54874
54900
|
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
|
|
54875
54901
|
}
|
|
54876
54902
|
}
|
|
@@ -54908,10 +54934,10 @@ function createTypeChecker(host) {
|
|
|
54908
54934
|
}
|
|
54909
54935
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
54910
54936
|
}
|
|
54911
|
-
const
|
|
54937
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
54912
54938
|
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
|
|
54913
54939
|
const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
54914
|
-
|
|
54940
|
+
restoreFlags();
|
|
54915
54941
|
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
|
|
54916
54942
|
}
|
|
54917
54943
|
}
|
|
@@ -55223,7 +55249,7 @@ function createTypeChecker(host) {
|
|
|
55223
55249
|
}
|
|
55224
55250
|
}
|
|
55225
55251
|
if (seenNames) {
|
|
55226
|
-
const
|
|
55252
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
55227
55253
|
context.flags |= 64 /* UseFullyQualifiedType */;
|
|
55228
55254
|
seenNames.forEach((types2) => {
|
|
55229
55255
|
if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
|
|
@@ -55232,7 +55258,7 @@ function createTypeChecker(host) {
|
|
|
55232
55258
|
}
|
|
55233
55259
|
}
|
|
55234
55260
|
});
|
|
55235
|
-
|
|
55261
|
+
restoreFlags();
|
|
55236
55262
|
}
|
|
55237
55263
|
return result;
|
|
55238
55264
|
}
|
|
@@ -55284,19 +55310,19 @@ function createTypeChecker(host) {
|
|
|
55284
55310
|
} else {
|
|
55285
55311
|
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
55286
55312
|
}
|
|
55287
|
-
const
|
|
55313
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
55288
55314
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55289
55315
|
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 */));
|
|
55290
55316
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
55291
55317
|
if (thisParameter) {
|
|
55292
55318
|
parameters.unshift(thisParameter);
|
|
55293
55319
|
}
|
|
55294
|
-
|
|
55320
|
+
restoreFlags();
|
|
55295
55321
|
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
55296
55322
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
55297
55323
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
55298
|
-
const
|
|
55299
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
55324
|
+
const flags = modifiersToFlags(modifiers);
|
|
55325
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
55300
55326
|
}
|
|
55301
55327
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
55302
55328
|
modifiers,
|
|
@@ -55516,13 +55542,13 @@ function createTypeChecker(host) {
|
|
|
55516
55542
|
}
|
|
55517
55543
|
}
|
|
55518
55544
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
55519
|
-
const
|
|
55545
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
55520
55546
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
55521
55547
|
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
55522
55548
|
const name = typeParameterToName(type, context);
|
|
55523
55549
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
55524
55550
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
55525
|
-
|
|
55551
|
+
restoreFlags();
|
|
55526
55552
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
|
55527
55553
|
}
|
|
55528
55554
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
|
@@ -55626,7 +55652,7 @@ function createTypeChecker(host) {
|
|
|
55626
55652
|
function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
|
|
55627
55653
|
let chain;
|
|
55628
55654
|
const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
|
|
55629
|
-
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.
|
|
55655
|
+
if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
|
|
55630
55656
|
chain = Debug.checkDefined(getSymbolChain(
|
|
55631
55657
|
symbol,
|
|
55632
55658
|
meaning,
|
|
@@ -56152,19 +56178,19 @@ function createTypeChecker(host) {
|
|
|
56152
56178
|
var _a, _b;
|
|
56153
56179
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
56154
56180
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
56155
|
-
const
|
|
56156
|
-
if (declaration && hasInferredType(declaration) && !(context.
|
|
56181
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
56182
|
+
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
56157
56183
|
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
|
|
56158
56184
|
}
|
|
56159
|
-
context.
|
|
56160
|
-
if (enclosingDeclaration && (!isErrorType(type) || context.
|
|
56185
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
56186
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
|
|
56161
56187
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
56162
56188
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
56163
56189
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
56164
56190
|
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
56165
56191
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
56166
56192
|
if (result2) {
|
|
56167
|
-
|
|
56193
|
+
restoreFlags();
|
|
56168
56194
|
return result2;
|
|
56169
56195
|
}
|
|
56170
56196
|
}
|
|
@@ -56175,7 +56201,7 @@ function createTypeChecker(host) {
|
|
|
56175
56201
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
56176
56202
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
56177
56203
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
56178
|
-
|
|
56204
|
+
restoreFlags();
|
|
56179
56205
|
return result;
|
|
56180
56206
|
}
|
|
56181
56207
|
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
@@ -56189,26 +56215,26 @@ function createTypeChecker(host) {
|
|
|
56189
56215
|
}
|
|
56190
56216
|
function serializeReturnTypeForSignature(context, signature) {
|
|
56191
56217
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
56192
|
-
const
|
|
56218
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
56193
56219
|
if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
56194
56220
|
let returnTypeNode;
|
|
56195
56221
|
const returnType = getReturnTypeOfSignature(signature);
|
|
56196
56222
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
56197
|
-
if (signature.declaration && !(context.
|
|
56223
|
+
if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
56198
56224
|
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
|
|
56199
56225
|
}
|
|
56200
|
-
context.
|
|
56226
|
+
context.internalFlags |= 2 /* NoSyntacticPrinter */;
|
|
56201
56227
|
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
56202
56228
|
} else if (!suppressAny) {
|
|
56203
56229
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
56204
56230
|
}
|
|
56205
|
-
|
|
56231
|
+
restoreFlags();
|
|
56206
56232
|
return returnTypeNode;
|
|
56207
56233
|
}
|
|
56208
56234
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
56209
56235
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
56210
56236
|
const type = getReturnTypeOfSignature(signature);
|
|
56211
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.
|
|
56237
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56212
56238
|
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
56213
56239
|
if (annotation) {
|
|
56214
56240
|
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
@@ -56710,7 +56736,7 @@ function createTypeChecker(host) {
|
|
|
56710
56736
|
if (!hasDynamicName(node)) {
|
|
56711
56737
|
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56712
56738
|
}
|
|
56713
|
-
if (!(context.
|
|
56739
|
+
if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
56714
56740
|
return void 0;
|
|
56715
56741
|
}
|
|
56716
56742
|
}
|
|
@@ -57362,7 +57388,7 @@ function createTypeChecker(host) {
|
|
|
57362
57388
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
57363
57389
|
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
|
|
57364
57390
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
57365
|
-
const
|
|
57391
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
57366
57392
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
57367
57393
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
57368
57394
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
@@ -57386,7 +57412,7 @@ function createTypeChecker(host) {
|
|
|
57386
57412
|
),
|
|
57387
57413
|
modifierFlags
|
|
57388
57414
|
);
|
|
57389
|
-
|
|
57415
|
+
restoreFlags();
|
|
57390
57416
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
57391
57417
|
}
|
|
57392
57418
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
|
@@ -58395,10 +58421,10 @@ function createTypeChecker(host) {
|
|
|
58395
58421
|
}
|
|
58396
58422
|
function getNameCandidateWorker(symbol, localName) {
|
|
58397
58423
|
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
|
|
58398
|
-
const
|
|
58424
|
+
const restoreFlags = saveRestoreFlags(context);
|
|
58399
58425
|
context.flags |= 16777216 /* InInitialEntityName */;
|
|
58400
58426
|
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
|
58401
|
-
|
|
58427
|
+
restoreFlags();
|
|
58402
58428
|
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
|
|
58403
58429
|
}
|
|
58404
58430
|
if (localName === "default" /* Default */) {
|
|
@@ -59981,7 +60007,8 @@ function createTypeChecker(host) {
|
|
|
59981
60007
|
if (!node) {
|
|
59982
60008
|
return void 0;
|
|
59983
60009
|
}
|
|
59984
|
-
|
|
60010
|
+
const kind = node.kind;
|
|
60011
|
+
switch (kind) {
|
|
59985
60012
|
case 263 /* ClassDeclaration */:
|
|
59986
60013
|
case 231 /* ClassExpression */:
|
|
59987
60014
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -60003,13 +60030,19 @@ function createTypeChecker(host) {
|
|
|
60003
60030
|
case 200 /* MappedType */:
|
|
60004
60031
|
case 194 /* ConditionalType */: {
|
|
60005
60032
|
const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
60006
|
-
if (
|
|
60033
|
+
if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
|
|
60034
|
+
const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
|
|
60035
|
+
if (signature && signature.typeParameters) {
|
|
60036
|
+
return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
|
|
60037
|
+
}
|
|
60038
|
+
}
|
|
60039
|
+
if (kind === 200 /* MappedType */) {
|
|
60007
60040
|
return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
|
|
60008
|
-
} else if (
|
|
60041
|
+
} else if (kind === 194 /* ConditionalType */) {
|
|
60009
60042
|
return concatenate(outerTypeParameters, getInferTypeParameters(node));
|
|
60010
60043
|
}
|
|
60011
60044
|
const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
|
|
60012
|
-
const thisType = includeThisTypes && (
|
|
60045
|
+
const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
|
|
60013
60046
|
return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
|
|
60014
60047
|
}
|
|
60015
60048
|
case 341 /* JSDocParameterTag */:
|
|
@@ -62821,8 +62854,11 @@ function createTypeChecker(host) {
|
|
|
62821
62854
|
true
|
|
62822
62855
|
);
|
|
62823
62856
|
}
|
|
62857
|
+
function getTypeParametersForMapper(signature) {
|
|
62858
|
+
return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
|
|
62859
|
+
}
|
|
62824
62860
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
62825
|
-
return createTypeMapper(
|
|
62861
|
+
return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
|
|
62826
62862
|
}
|
|
62827
62863
|
function getErasedSignature(signature) {
|
|
62828
62864
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -75836,7 +75872,7 @@ function createTypeChecker(host) {
|
|
|
75836
75872
|
type,
|
|
75837
75873
|
(t) => {
|
|
75838
75874
|
var _a;
|
|
75839
|
-
if (isGenericMappedType(t) &&
|
|
75875
|
+
if (isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */) {
|
|
75840
75876
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
75841
75877
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
75842
75878
|
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
@@ -78522,7 +78558,7 @@ function createTypeChecker(host) {
|
|
|
78522
78558
|
return void 0;
|
|
78523
78559
|
}
|
|
78524
78560
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
78525
|
-
const context = createInferenceContext(signature
|
|
78561
|
+
const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
|
|
78526
78562
|
const restType = getEffectiveRestType(contextualSignature);
|
|
78527
78563
|
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
|
|
78528
78564
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
@@ -90559,14 +90595,14 @@ function createTypeChecker(host) {
|
|
|
90559
90595
|
return 11 /* ObjectType */;
|
|
90560
90596
|
}
|
|
90561
90597
|
}
|
|
90562
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
90598
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
90563
90599
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
90564
90600
|
if (!declaration) {
|
|
90565
90601
|
return factory.createToken(133 /* AnyKeyword */);
|
|
90566
90602
|
}
|
|
90567
90603
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
90568
90604
|
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
90569
|
-
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
90605
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
90570
90606
|
}
|
|
90571
90607
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
90572
90608
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -90609,14 +90645,14 @@ function createTypeChecker(host) {
|
|
|
90609
90645
|
}
|
|
90610
90646
|
return candidateExpr;
|
|
90611
90647
|
}
|
|
90612
|
-
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
90648
|
+
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
90613
90649
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
90614
90650
|
if (!signatureDeclaration) {
|
|
90615
90651
|
return factory.createToken(133 /* AnyKeyword */);
|
|
90616
90652
|
}
|
|
90617
|
-
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
90653
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
|
|
90618
90654
|
}
|
|
90619
|
-
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
90655
|
+
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
|
|
90620
90656
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
90621
90657
|
if (!expr) {
|
|
90622
90658
|
return factory.createToken(133 /* AnyKeyword */);
|
|
@@ -90629,6 +90665,7 @@ function createTypeChecker(host) {
|
|
|
90629
90665
|
void 0,
|
|
90630
90666
|
enclosingDeclaration,
|
|
90631
90667
|
flags | 1024 /* MultilineObjectLiterals */,
|
|
90668
|
+
internalFlags,
|
|
90632
90669
|
tracker
|
|
90633
90670
|
);
|
|
90634
90671
|
}
|
|
@@ -90734,6 +90771,8 @@ function createTypeChecker(host) {
|
|
|
90734
90771
|
enclosing,
|
|
90735
90772
|
/*flags*/
|
|
90736
90773
|
void 0,
|
|
90774
|
+
/*internalFlags*/
|
|
90775
|
+
void 0,
|
|
90737
90776
|
tracker
|
|
90738
90777
|
) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
|
|
90739
90778
|
if (enumResult) return enumResult;
|
|
@@ -90862,15 +90901,15 @@ function createTypeChecker(host) {
|
|
|
90862
90901
|
const parseDecl = getParseTreeNode(decl);
|
|
90863
90902
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
90864
90903
|
},
|
|
90865
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
90904
|
+
getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
|
|
90866
90905
|
const n = getParseTreeNode(node);
|
|
90867
90906
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
90868
90907
|
const sym = getSymbolOfDeclaration(node);
|
|
90869
90908
|
if (!sym) {
|
|
90870
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
90909
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
|
|
90871
90910
|
}
|
|
90872
90911
|
resolveExternalModuleSymbol(sym);
|
|
90873
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
90912
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
90874
90913
|
},
|
|
90875
90914
|
isImportRequiredByAugmentation,
|
|
90876
90915
|
isDefinitelyReferenceToGlobalSymbolObject
|
|
@@ -96024,7 +96063,6 @@ function transformTypeScript(context) {
|
|
|
96024
96063
|
let currentNamespaceContainerName;
|
|
96025
96064
|
let currentLexicalScope;
|
|
96026
96065
|
let currentScopeFirstDeclarationsOfName;
|
|
96027
|
-
let currentClassHasParameterProperties;
|
|
96028
96066
|
let enabledSubstitutions;
|
|
96029
96067
|
let applicableSubstitutions;
|
|
96030
96068
|
return transformSourceFileOrBundle;
|
|
@@ -96052,14 +96090,12 @@ function transformTypeScript(context) {
|
|
|
96052
96090
|
function saveStateAndInvoke(node, f) {
|
|
96053
96091
|
const savedCurrentScope = currentLexicalScope;
|
|
96054
96092
|
const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
|
|
96055
|
-
const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
|
|
96056
96093
|
onBeforeVisitNode(node);
|
|
96057
96094
|
const visited = f(node);
|
|
96058
96095
|
if (currentLexicalScope !== savedCurrentScope) {
|
|
96059
96096
|
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
|
|
96060
96097
|
}
|
|
96061
96098
|
currentLexicalScope = savedCurrentScope;
|
|
96062
|
-
currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
|
|
96063
96099
|
return visited;
|
|
96064
96100
|
}
|
|
96065
96101
|
function onBeforeVisitNode(node) {
|
|
@@ -96692,7 +96728,7 @@ function transformTypeScript(context) {
|
|
|
96692
96728
|
}
|
|
96693
96729
|
function visitPropertyNameOfClassElement(member) {
|
|
96694
96730
|
const name = member.name;
|
|
96695
|
-
if (
|
|
96731
|
+
if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
|
|
96696
96732
|
const expression = visitNode(name.expression, visitor, isExpression);
|
|
96697
96733
|
Debug.assert(expression);
|
|
96698
96734
|
const innerExpression = skipPartiallyEmittedExpressions(expression);
|
|
@@ -116155,7 +116191,8 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
116155
116191
|
false
|
|
116156
116192
|
).diagnostics : void 0;
|
|
116157
116193
|
}
|
|
116158
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ |
|
|
116194
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
116195
|
+
var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
|
|
116159
116196
|
function transformDeclarations(context) {
|
|
116160
116197
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
116161
116198
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
@@ -116311,7 +116348,7 @@ function transformDeclarations(context) {
|
|
|
116311
116348
|
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,
|
|
116312
116349
|
errorNode: s.errorNode || sourceFile
|
|
116313
116350
|
};
|
|
116314
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
116351
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
116315
116352
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
116316
116353
|
return result;
|
|
116317
116354
|
}
|
|
@@ -116581,7 +116618,7 @@ function transformDeclarations(context) {
|
|
|
116581
116618
|
case 172 /* PropertyDeclaration */:
|
|
116582
116619
|
case 208 /* BindingElement */:
|
|
116583
116620
|
case 260 /* VariableDeclaration */:
|
|
116584
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
116621
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
116585
116622
|
break;
|
|
116586
116623
|
case 262 /* FunctionDeclaration */:
|
|
116587
116624
|
case 180 /* ConstructSignature */:
|
|
@@ -116589,7 +116626,7 @@ function transformDeclarations(context) {
|
|
|
116589
116626
|
case 174 /* MethodDeclaration */:
|
|
116590
116627
|
case 177 /* GetAccessor */:
|
|
116591
116628
|
case 179 /* CallSignature */:
|
|
116592
|
-
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
116629
|
+
typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
116593
116630
|
break;
|
|
116594
116631
|
default:
|
|
116595
116632
|
Debug.assertNever(node);
|
|
@@ -117190,7 +117227,7 @@ function transformDeclarations(context) {
|
|
|
117190
117227
|
newId,
|
|
117191
117228
|
/*exclamationToken*/
|
|
117192
117229
|
void 0,
|
|
117193
|
-
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
117230
|
+
resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
117194
117231
|
/*initializer*/
|
|
117195
117232
|
void 0
|
|
117196
117233
|
);
|
|
@@ -117316,7 +117353,7 @@ function transformDeclarations(context) {
|
|
|
117316
117353
|
return void 0;
|
|
117317
117354
|
}
|
|
117318
117355
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
117319
|
-
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags |
|
|
117356
|
+
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
|
|
117320
117357
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
117321
117358
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
117322
117359
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
@@ -117519,7 +117556,7 @@ function transformDeclarations(context) {
|
|
|
117519
117556
|
newId,
|
|
117520
117557
|
/*exclamationToken*/
|
|
117521
117558
|
void 0,
|
|
117522
|
-
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
|
|
117559
|
+
resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
|
|
117523
117560
|
/*initializer*/
|
|
117524
117561
|
void 0
|
|
117525
117562
|
);
|
|
@@ -138309,7 +138346,7 @@ function getTypeNodeIfAccessible(type, enclosingScope, program, host) {
|
|
|
138309
138346
|
const checker = program.getTypeChecker();
|
|
138310
138347
|
let typeIsAccessible = true;
|
|
138311
138348
|
const notAccessible = () => typeIsAccessible = false;
|
|
138312
|
-
const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, {
|
|
138349
|
+
const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, {
|
|
138313
138350
|
trackSymbol: (symbol, declaration, meaning) => {
|
|
138314
138351
|
typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible(
|
|
138315
138352
|
symbol,
|
|
@@ -144166,7 +144203,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
144166
144203
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
144167
144204
|
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName);
|
|
144168
144205
|
if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0 /* EqualTo */) return;
|
|
144169
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
144206
|
+
const newModuleSpecifier = ts_moduleSpecifiers_exports.getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
144170
144207
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
144171
144208
|
if (newImportDeclaration) changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
144172
144209
|
const ns = getNamespaceLikeImport(importNode);
|
|
@@ -147233,7 +147270,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147233
147270
|
if (!isJS) {
|
|
147234
147271
|
let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node);
|
|
147235
147272
|
type = checker.getBaseTypeOfLiteralType(type);
|
|
147236
|
-
typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */);
|
|
147273
|
+
typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
147237
147274
|
}
|
|
147238
147275
|
const paramDecl = factory.createParameterDeclaration(
|
|
147239
147276
|
/*modifiers*/
|
|
@@ -147262,7 +147299,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147262
147299
|
)) : void 0;
|
|
147263
147300
|
if (isExpression(node) && !isJS) {
|
|
147264
147301
|
const contextualType = checker.getContextualType(node);
|
|
147265
|
-
returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */);
|
|
147302
|
+
returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
147266
147303
|
}
|
|
147267
147304
|
const { body, returnValueProperty } = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & 1 /* HasReturn */));
|
|
147268
147305
|
suppressLeadingAndTrailingTrivia(body);
|
|
@@ -147302,7 +147339,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147302
147339
|
checker.typeToTypeNode(
|
|
147303
147340
|
checker.getTypeAtLocation(range.thisNode),
|
|
147304
147341
|
scope,
|
|
147305
|
-
1 /* NoTruncation
|
|
147342
|
+
1 /* NoTruncation */,
|
|
147343
|
+
8 /* AllowUnresolvedNames */
|
|
147306
147344
|
),
|
|
147307
147345
|
/*initializer*/
|
|
147308
147346
|
void 0
|
|
@@ -147399,7 +147437,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147399
147437
|
const variableType = checker.typeToTypeNode(
|
|
147400
147438
|
checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)),
|
|
147401
147439
|
scope,
|
|
147402
|
-
1 /* NoTruncation
|
|
147440
|
+
1 /* NoTruncation */,
|
|
147441
|
+
8 /* AllowUnresolvedNames */
|
|
147403
147442
|
);
|
|
147404
147443
|
typeElements.push(factory.createPropertySignature(
|
|
147405
147444
|
/*modifiers*/
|
|
@@ -147530,7 +147569,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
|
|
|
147530
147569
|
const file = scope.getSourceFile();
|
|
147531
147570
|
const localNameText = getIdentifierForNode(node, scope, checker, file);
|
|
147532
147571
|
const isJS = isInJSFile(scope);
|
|
147533
|
-
let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
|
|
147572
|
+
let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
147534
147573
|
let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
|
|
147535
147574
|
({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer));
|
|
147536
147575
|
suppressLeadingAndTrailingTrivia(initializer);
|
|
@@ -147655,13 +147694,13 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
|
|
|
147655
147694
|
} else {
|
|
147656
147695
|
const paramType = checker.getTypeAtLocation(p);
|
|
147657
147696
|
if (paramType === checker.getAnyType()) hasAny = true;
|
|
147658
|
-
parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */), p.initializer));
|
|
147697
|
+
parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), p.initializer));
|
|
147659
147698
|
}
|
|
147660
147699
|
}
|
|
147661
147700
|
if (hasAny) return { variableType: variableType2, initializer: initializer2 };
|
|
147662
147701
|
variableType2 = void 0;
|
|
147663
147702
|
if (isArrowFunction(initializer2)) {
|
|
147664
|
-
initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), initializer2.equalsGreaterThanToken, initializer2.body);
|
|
147703
|
+
initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), initializer2.equalsGreaterThanToken, initializer2.body);
|
|
147665
147704
|
} else {
|
|
147666
147705
|
if (functionSignature && !!functionSignature.thisParameter) {
|
|
147667
147706
|
const firstParameter = firstOrUndefined(parameters);
|
|
@@ -147678,7 +147717,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
|
|
|
147678
147717
|
"this",
|
|
147679
147718
|
/*questionToken*/
|
|
147680
147719
|
void 0,
|
|
147681
|
-
checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */)
|
|
147720
|
+
checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */)
|
|
147682
147721
|
)
|
|
147683
147722
|
);
|
|
147684
147723
|
}
|
|
@@ -148299,7 +148338,7 @@ function getInfo4(context) {
|
|
|
148299
148338
|
if (signature) {
|
|
148300
148339
|
const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
|
|
148301
148340
|
if (typePredicate && typePredicate.type) {
|
|
148302
|
-
const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */);
|
|
148341
|
+
const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
148303
148342
|
if (typePredicateTypeNode) {
|
|
148304
148343
|
return { declaration, returnTypeNode: typePredicateTypeNode };
|
|
148305
148344
|
}
|
|
@@ -148311,7 +148350,7 @@ function getInfo4(context) {
|
|
|
148311
148350
|
if (!returnType) {
|
|
148312
148351
|
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) };
|
|
148313
148352
|
}
|
|
148314
|
-
const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */);
|
|
148353
|
+
const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
148315
148354
|
if (returnTypeNode) {
|
|
148316
148355
|
return { declaration, returnTypeNode };
|
|
148317
148356
|
}
|
|
@@ -154823,6 +154862,8 @@ function addMissingDeclarations(context, implementedTypeNode, sourceFile, classD
|
|
|
154823
154862
|
classDeclaration,
|
|
154824
154863
|
/*flags*/
|
|
154825
154864
|
void 0,
|
|
154865
|
+
/*internalFlags*/
|
|
154866
|
+
void 0,
|
|
154826
154867
|
getNoopSymbolTrackerWithResolver(context)
|
|
154827
154868
|
));
|
|
154828
154869
|
}
|
|
@@ -156454,6 +156495,8 @@ function addMissingConstraint(changes, program, preferences, host, sourceFile, i
|
|
|
156454
156495
|
scriptTarget,
|
|
156455
156496
|
/*flags*/
|
|
156456
156497
|
void 0,
|
|
156498
|
+
/*internalFlags*/
|
|
156499
|
+
void 0,
|
|
156457
156500
|
tracker
|
|
156458
156501
|
);
|
|
156459
156502
|
if (typeNode) {
|
|
@@ -157561,14 +157604,15 @@ function getTypeNode2(checker, node, token) {
|
|
|
157561
157604
|
const binaryExpression = token.parent.parent;
|
|
157562
157605
|
const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
|
|
157563
157606
|
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
|
|
157564
|
-
typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */);
|
|
157607
|
+
typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
|
|
157565
157608
|
} else {
|
|
157566
157609
|
const contextualType = checker.getContextualType(token.parent);
|
|
157567
157610
|
typeNode = contextualType ? checker.typeToTypeNode(
|
|
157568
157611
|
contextualType,
|
|
157569
157612
|
/*enclosingDeclaration*/
|
|
157570
157613
|
void 0,
|
|
157571
|
-
1 /* NoTruncation
|
|
157614
|
+
1 /* NoTruncation */,
|
|
157615
|
+
8 /* AllowUnresolvedNames */
|
|
157572
157616
|
) : void 0;
|
|
157573
157617
|
}
|
|
157574
157618
|
return typeNode || factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
@@ -157890,7 +157934,9 @@ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker)
|
|
|
157890
157934
|
111551 /* Value */,
|
|
157891
157935
|
/*enclosingDeclaration*/
|
|
157892
157936
|
void 0,
|
|
157893
|
-
|
|
157937
|
+
/*flags*/
|
|
157938
|
+
void 0,
|
|
157939
|
+
1 /* WriteComputedProps */
|
|
157894
157940
|
);
|
|
157895
157941
|
if (prop && isComputedPropertyName(prop)) return prop;
|
|
157896
157942
|
}
|
|
@@ -158063,7 +158109,7 @@ function tryGetName2(node) {
|
|
|
158063
158109
|
}
|
|
158064
158110
|
}
|
|
158065
158111
|
function typeToTypeNode(checker, type, enclosingDeclaration) {
|
|
158066
|
-
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
158112
|
+
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
158067
158113
|
}
|
|
158068
158114
|
function doChange19(changes, program, preferences, host, declarations, newParameters) {
|
|
158069
158115
|
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
@@ -159366,7 +159412,8 @@ var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
|
|
|
159366
159412
|
206 /* ObjectBindingPattern */,
|
|
159367
159413
|
207 /* ArrayBindingPattern */
|
|
159368
159414
|
]);
|
|
159369
|
-
var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation
|
|
159415
|
+
var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
159416
|
+
var declarationEmitInternalNodeBuilderFlags2 = 1 /* WriteComputedProps */;
|
|
159370
159417
|
registerCodeFix({
|
|
159371
159418
|
errorCodes: errorCodes47,
|
|
159372
159419
|
fixIds: [fixId36],
|
|
@@ -160152,7 +160199,7 @@ function withContext(context, typePrintMode, cb) {
|
|
|
160152
160199
|
}
|
|
160153
160200
|
function typeToTypeNode2(type, enclosingDeclaration, flags = 0 /* None */) {
|
|
160154
160201
|
let isTruncated = false;
|
|
160155
|
-
const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
|
|
160202
|
+
const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
|
|
160156
160203
|
moduleResolverHost: program,
|
|
160157
160204
|
trackSymbol() {
|
|
160158
160205
|
return true;
|
|
@@ -160165,7 +160212,7 @@ function withContext(context, typePrintMode, cb) {
|
|
|
160165
160212
|
}
|
|
160166
160213
|
function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
|
|
160167
160214
|
let isTruncated = false;
|
|
160168
|
-
const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
|
|
160215
|
+
const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
|
|
160169
160216
|
moduleResolverHost: program,
|
|
160170
160217
|
trackSymbol() {
|
|
160171
160218
|
return true;
|
|
@@ -161492,7 +161539,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
161492
161539
|
case 172 /* PropertyDeclaration */:
|
|
161493
161540
|
let flags = 1 /* NoTruncation */;
|
|
161494
161541
|
flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
|
|
161495
|
-
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
|
|
161542
|
+
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
|
|
161496
161543
|
if (importAdder) {
|
|
161497
161544
|
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
161498
161545
|
if (importableReference) {
|
|
@@ -161517,6 +161564,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
161517
161564
|
enclosingDeclaration,
|
|
161518
161565
|
/*flags*/
|
|
161519
161566
|
void 0,
|
|
161567
|
+
/*internalFlags*/
|
|
161568
|
+
void 0,
|
|
161520
161569
|
getNoopSymbolTrackerWithResolver(context)
|
|
161521
161570
|
);
|
|
161522
161571
|
const allAccessors = getAllAccessorDeclarations(declarations, declaration);
|
|
@@ -161646,7 +161695,7 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
|
|
|
161646
161695
|
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
161647
161696
|
const isJs = isInJSFile(enclosingDeclaration);
|
|
161648
161697
|
const flags = 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */ | 524288 /* AllowEmptyTuple */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
161649
|
-
const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
|
|
161698
|
+
const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
|
|
161650
161699
|
if (!signatureDeclaration) {
|
|
161651
161700
|
return void 0;
|
|
161652
161701
|
}
|
|
@@ -161747,6 +161796,7 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
|
|
|
161747
161796
|
contextNode,
|
|
161748
161797
|
scriptTarget,
|
|
161749
161798
|
1 /* NoTruncation */,
|
|
161799
|
+
8 /* AllowUnresolvedNames */,
|
|
161750
161800
|
tracker
|
|
161751
161801
|
);
|
|
161752
161802
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
|
|
@@ -161765,6 +161815,8 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
|
|
|
161765
161815
|
contextNode,
|
|
161766
161816
|
/*flags*/
|
|
161767
161817
|
void 0,
|
|
161818
|
+
/*internalFlags*/
|
|
161819
|
+
void 0,
|
|
161768
161820
|
tracker
|
|
161769
161821
|
);
|
|
161770
161822
|
switch (kind) {
|
|
@@ -161834,8 +161886,8 @@ function createTypeParametersForArguments(checker, argumentTypeParameters, typeA
|
|
|
161834
161886
|
function createTypeParameterName(index) {
|
|
161835
161887
|
return 84 /* T */ + index <= 90 /* Z */ ? String.fromCharCode(84 /* T */ + index) : `T${index}`;
|
|
161836
161888
|
}
|
|
161837
|
-
function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
|
|
161838
|
-
let typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker);
|
|
161889
|
+
function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, internalFlags, tracker) {
|
|
161890
|
+
let typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
|
|
161839
161891
|
if (typeNode && isImportTypeNode(typeNode)) {
|
|
161840
161892
|
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
|
161841
161893
|
if (importableReference) {
|
|
@@ -161845,8 +161897,8 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
|
|
|
161845
161897
|
}
|
|
161846
161898
|
return getSynthesizedDeepClone(typeNode);
|
|
161847
161899
|
}
|
|
161848
|
-
function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, tracker) {
|
|
161849
|
-
let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, tracker);
|
|
161900
|
+
function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, internalFlags, tracker) {
|
|
161901
|
+
let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, internalFlags, tracker);
|
|
161850
161902
|
if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
|
|
161851
161903
|
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
|
|
161852
161904
|
if (importableReference) {
|
|
@@ -161862,7 +161914,7 @@ function typeContainsTypeParameter(type) {
|
|
|
161862
161914
|
}
|
|
161863
161915
|
return type.flags & 262144 /* TypeParameter */;
|
|
161864
161916
|
}
|
|
161865
|
-
function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, tracker) {
|
|
161917
|
+
function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, internalFlags, tracker) {
|
|
161866
161918
|
const argumentTypeNodes = [];
|
|
161867
161919
|
const argumentTypeParameters = /* @__PURE__ */ new Map();
|
|
161868
161920
|
for (let i = 0; i < instanceTypes.length; i += 1) {
|
|
@@ -161874,13 +161926,13 @@ function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes,
|
|
|
161874
161926
|
continue;
|
|
161875
161927
|
}
|
|
161876
161928
|
const widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType);
|
|
161877
|
-
const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, tracker);
|
|
161929
|
+
const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, internalFlags, tracker);
|
|
161878
161930
|
if (!argumentTypeNode) {
|
|
161879
161931
|
continue;
|
|
161880
161932
|
}
|
|
161881
161933
|
argumentTypeNodes.push(argumentTypeNode);
|
|
161882
161934
|
const argumentTypeParameter = getFirstTypeParameterName(instanceType);
|
|
161883
|
-
const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, tracker) : void 0;
|
|
161935
|
+
const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, internalFlags, tracker) : void 0;
|
|
161884
161936
|
if (argumentTypeParameter) {
|
|
161885
161937
|
argumentTypeParameters.set(argumentTypeParameter, { argumentType: instanceType, constraint: instanceTypeConstraint });
|
|
161886
161938
|
}
|
|
@@ -161980,7 +162032,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
|
|
|
161980
162032
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
161981
162033
|
if (length(signatures)) {
|
|
161982
162034
|
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
|
|
161983
|
-
return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
|
|
162035
|
+
return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
|
|
161984
162036
|
}
|
|
161985
162037
|
}
|
|
161986
162038
|
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
@@ -164555,7 +164607,14 @@ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, pro
|
|
|
164555
164607
|
if (signatures.length !== 1) {
|
|
164556
164608
|
return void 0;
|
|
164557
164609
|
}
|
|
164558
|
-
const typeNode = checker.typeToTypeNode(
|
|
164610
|
+
const typeNode = checker.typeToTypeNode(
|
|
164611
|
+
effectiveType,
|
|
164612
|
+
enclosingDeclaration,
|
|
164613
|
+
builderFlags,
|
|
164614
|
+
/*internalFlags*/
|
|
164615
|
+
void 0,
|
|
164616
|
+
ts_codefix_exports.getNoopSymbolTrackerWithResolver({ program, host })
|
|
164617
|
+
);
|
|
164559
164618
|
if (!typeNode || !isFunctionTypeNode(typeNode)) {
|
|
164560
164619
|
return void 0;
|
|
164561
164620
|
}
|
|
@@ -167659,7 +167718,7 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
|
|
|
167659
167718
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
167660
167719
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
167661
167720
|
}
|
|
167662
|
-
let allowedEndings = getModuleSpecifierPreferences(
|
|
167721
|
+
let allowedEndings = ts_moduleSpecifiers_exports.getModuleSpecifierPreferences(
|
|
167663
167722
|
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
167664
167723
|
program,
|
|
167665
167724
|
program.getCompilerOptions(),
|
|
@@ -179235,6 +179294,7 @@ __export(ts_exports2, {
|
|
|
179235
179294
|
InlayHintKind: () => InlayHintKind2,
|
|
179236
179295
|
InlayHints: () => ts_InlayHints_exports,
|
|
179237
179296
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
179297
|
+
InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
|
|
179238
179298
|
InternalSymbolName: () => InternalSymbolName,
|
|
179239
179299
|
IntersectionFlags: () => IntersectionFlags,
|
|
179240
179300
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
@@ -193620,6 +193680,7 @@ if (typeof console !== "undefined") {
|
|
|
193620
193680
|
InlayHintKind,
|
|
193621
193681
|
InlayHints,
|
|
193622
193682
|
InternalEmitFlags,
|
|
193683
|
+
InternalNodeBuilderFlags,
|
|
193623
193684
|
InternalSymbolName,
|
|
193624
193685
|
IntersectionFlags,
|
|
193625
193686
|
InvalidatedProjectKind,
|