@schematics/angular 19.2.0 → 20.0.0-next.0
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/application/index.js +6 -6
- package/config/index.js +8 -7
- package/e2e/index.js +10 -7
- package/environments/index.js +8 -7
- package/library/index.js +4 -4
- package/migrations/use-application-builder/migration.js +11 -3
- package/package.json +4 -4
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +0 -9
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +107 -554
- package/utility/latest-versions/package.json +3 -3
- package/utility/latest-versions.js +5 -5
|
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2285
2285
|
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
|
2287
2287
|
var versionMajorMinor = "5.8";
|
|
2288
|
-
var version = "5.8.
|
|
2288
|
+
var version = "5.8.2";
|
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6538,7 +6538,6 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6538
6538
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
|
6539
6539
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
|
6540
6540
|
ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
|
|
6541
|
-
ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
|
|
6542
6541
|
ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
|
|
6543
6542
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
|
|
6544
6543
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
@@ -10211,7 +10210,7 @@ var Diagnostics = {
|
|
|
10211
10210
|
This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2877, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2877", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
|
|
10212
10211
|
This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
|
|
10213
10212
|
Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
|
|
10214
|
-
|
|
10213
|
+
Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
|
|
10215
10214
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10216
10215
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10217
10216
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -46162,7 +46161,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
46162
46161
|
state2,
|
|
46163
46162
|
packageInfo
|
|
46164
46163
|
);
|
|
46165
|
-
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
46164
|
+
if (!pathAndExtension && !rest && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
46166
46165
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
46167
46166
|
}
|
|
46168
46167
|
return withPackageId(packageInfo, pathAndExtension, state2);
|
|
@@ -50987,8 +50986,8 @@ function createTypeChecker(host) {
|
|
|
50987
50986
|
writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
|
|
50988
50987
|
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
|
|
50989
50988
|
},
|
|
50990
|
-
writeType: (type, enclosingDeclaration, flags, writer
|
|
50991
|
-
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer
|
|
50989
|
+
writeType: (type, enclosingDeclaration, flags, writer) => {
|
|
50990
|
+
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
|
|
50992
50991
|
},
|
|
50993
50992
|
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
|
50994
50993
|
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
|
@@ -51786,7 +51785,6 @@ function createTypeChecker(host) {
|
|
|
51786
51785
|
[".jsx", ".jsx"],
|
|
51787
51786
|
[".json", ".json"]
|
|
51788
51787
|
];
|
|
51789
|
-
var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
|
|
51790
51788
|
initializeTypeChecker();
|
|
51791
51789
|
return checker;
|
|
51792
51790
|
function isDefinitelyReferenceToGlobalSymbolObject(node) {
|
|
@@ -54922,18 +54920,14 @@ function createTypeChecker(host) {
|
|
|
54922
54920
|
return writer2;
|
|
54923
54921
|
}
|
|
54924
54922
|
}
|
|
54925
|
-
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")
|
|
54926
|
-
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation
|
|
54923
|
+
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
|
54924
|
+
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
|
54927
54925
|
const typeNode = nodeBuilder.typeToTypeNode(
|
|
54928
54926
|
type,
|
|
54929
54927
|
enclosingDeclaration,
|
|
54930
|
-
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
|
|
54928
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
|
|
54931
54929
|
/*internalFlags*/
|
|
54932
|
-
void 0
|
|
54933
|
-
/*tracker*/
|
|
54934
|
-
void 0,
|
|
54935
|
-
verbosityLevel,
|
|
54936
|
-
out
|
|
54930
|
+
void 0
|
|
54937
54931
|
);
|
|
54938
54932
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
|
54939
54933
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
|
@@ -55160,127 +55154,31 @@ function createTypeChecker(host) {
|
|
|
55160
55154
|
};
|
|
55161
55155
|
return {
|
|
55162
55156
|
syntacticBuilderResolver,
|
|
55163
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker
|
|
55164
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55165
|
-
|
|
55166
|
-
|
|
55167
|
-
|
|
55168
|
-
|
|
55169
|
-
|
|
55170
|
-
|
|
55171
|
-
|
|
55172
|
-
|
|
55173
|
-
|
|
55174
|
-
|
|
55175
|
-
|
|
55176
|
-
|
|
55177
|
-
|
|
55178
|
-
|
|
55179
|
-
|
|
55180
|
-
|
|
55181
|
-
),
|
|
55182
|
-
|
|
55183
|
-
|
|
55184
|
-
|
|
55185
|
-
|
|
55186
|
-
|
|
55187
|
-
|
|
55188
|
-
void 0,
|
|
55189
|
-
(context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
|
|
55190
|
-
),
|
|
55191
|
-
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55192
|
-
enclosingDeclaration,
|
|
55193
|
-
flags,
|
|
55194
|
-
internalFlags,
|
|
55195
|
-
tracker,
|
|
55196
|
-
/*verbosityLevel*/
|
|
55197
|
-
void 0,
|
|
55198
|
-
(context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
|
|
55199
|
-
),
|
|
55200
|
-
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55201
|
-
enclosingDeclaration,
|
|
55202
|
-
flags,
|
|
55203
|
-
internalFlags,
|
|
55204
|
-
tracker,
|
|
55205
|
-
/*verbosityLevel*/
|
|
55206
|
-
void 0,
|
|
55207
|
-
(context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
55208
|
-
indexInfo,
|
|
55209
|
-
context,
|
|
55210
|
-
/*typeNode*/
|
|
55211
|
-
void 0
|
|
55212
|
-
)
|
|
55213
|
-
),
|
|
55214
|
-
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55215
|
-
enclosingDeclaration,
|
|
55216
|
-
flags,
|
|
55217
|
-
internalFlags,
|
|
55218
|
-
tracker,
|
|
55219
|
-
/*verbosityLevel*/
|
|
55220
|
-
void 0,
|
|
55221
|
-
(context) => signatureToSignatureDeclarationHelper(signature, kind, context)
|
|
55222
|
-
),
|
|
55223
|
-
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55224
|
-
enclosingDeclaration,
|
|
55225
|
-
flags,
|
|
55226
|
-
internalFlags,
|
|
55227
|
-
tracker,
|
|
55228
|
-
/*verbosityLevel*/
|
|
55229
|
-
void 0,
|
|
55230
|
-
(context) => symbolToName(
|
|
55231
|
-
symbol,
|
|
55232
|
-
context,
|
|
55233
|
-
meaning,
|
|
55234
|
-
/*expectsIdentifier*/
|
|
55235
|
-
false
|
|
55236
|
-
)
|
|
55237
|
-
),
|
|
55238
|
-
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55239
|
-
enclosingDeclaration,
|
|
55240
|
-
flags,
|
|
55241
|
-
internalFlags,
|
|
55242
|
-
tracker,
|
|
55243
|
-
/*verbosityLevel*/
|
|
55244
|
-
void 0,
|
|
55245
|
-
(context) => symbolToExpression(symbol, context, meaning)
|
|
55246
|
-
),
|
|
55247
|
-
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55248
|
-
enclosingDeclaration,
|
|
55249
|
-
flags,
|
|
55250
|
-
internalFlags,
|
|
55251
|
-
tracker,
|
|
55252
|
-
/*verbosityLevel*/
|
|
55253
|
-
void 0,
|
|
55254
|
-
(context) => typeParametersToTypeParameterDeclarations(symbol, context)
|
|
55255
|
-
),
|
|
55256
|
-
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55257
|
-
enclosingDeclaration,
|
|
55258
|
-
flags,
|
|
55259
|
-
internalFlags,
|
|
55260
|
-
tracker,
|
|
55261
|
-
/*verbosityLevel*/
|
|
55262
|
-
void 0,
|
|
55263
|
-
(context) => symbolToParameterDeclaration(symbol, context)
|
|
55264
|
-
),
|
|
55265
|
-
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context)),
|
|
55266
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55267
|
-
enclosingDeclaration,
|
|
55268
|
-
flags,
|
|
55269
|
-
internalFlags,
|
|
55270
|
-
tracker,
|
|
55271
|
-
/*verbosityLevel*/
|
|
55272
|
-
void 0,
|
|
55273
|
-
(context) => symbolTableToDeclarationStatements(symbolTable, context)
|
|
55274
|
-
),
|
|
55275
|
-
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
|
55276
|
-
enclosingDeclaration,
|
|
55277
|
-
flags,
|
|
55278
|
-
internalFlags,
|
|
55279
|
-
tracker,
|
|
55280
|
-
/*verbosityLevel*/
|
|
55281
|
-
void 0,
|
|
55282
|
-
(context) => symbolToNode(symbol, context, meaning)
|
|
55283
|
-
)
|
|
55157
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
55158
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
55159
|
+
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)),
|
|
55160
|
+
serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)),
|
|
55161
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)),
|
|
55162
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
55163
|
+
indexInfo,
|
|
55164
|
+
context,
|
|
55165
|
+
/*typeNode*/
|
|
55166
|
+
void 0
|
|
55167
|
+
)),
|
|
55168
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
55169
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
|
|
55170
|
+
symbol,
|
|
55171
|
+
context,
|
|
55172
|
+
meaning,
|
|
55173
|
+
/*expectsIdentifier*/
|
|
55174
|
+
false
|
|
55175
|
+
)),
|
|
55176
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
55177
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
55178
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
55179
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
55180
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
55181
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
55284
55182
|
};
|
|
55285
55183
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
55286
55184
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
@@ -55322,7 +55220,7 @@ function createTypeChecker(host) {
|
|
|
55322
55220
|
}
|
|
55323
55221
|
return symbolToExpression(symbol, context, meaning);
|
|
55324
55222
|
}
|
|
55325
|
-
function withContext2(enclosingDeclaration, flags, internalFlags, tracker,
|
|
55223
|
+
function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
|
55326
55224
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
55327
55225
|
const context = {
|
|
55328
55226
|
enclosingDeclaration,
|
|
@@ -55330,7 +55228,6 @@ function createTypeChecker(host) {
|
|
|
55330
55228
|
flags: flags || 0 /* None */,
|
|
55331
55229
|
internalFlags: internalFlags || 0 /* None */,
|
|
55332
55230
|
tracker: void 0,
|
|
55333
|
-
unfoldDepth: verbosityLevel ?? -1,
|
|
55334
55231
|
encounteredError: false,
|
|
55335
55232
|
suppressReportInferenceFallback: false,
|
|
55336
55233
|
reportedDiagnostic: false,
|
|
@@ -55352,18 +55249,13 @@ function createTypeChecker(host) {
|
|
|
55352
55249
|
typeParameterNamesByText: void 0,
|
|
55353
55250
|
typeParameterNamesByTextNextNameCount: void 0,
|
|
55354
55251
|
enclosingSymbolTypes: /* @__PURE__ */ new Map(),
|
|
55355
|
-
mapper: void 0
|
|
55356
|
-
depth: 0,
|
|
55357
|
-
couldUnfoldMore: false
|
|
55252
|
+
mapper: void 0
|
|
55358
55253
|
};
|
|
55359
55254
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
55360
55255
|
const resultingNode = cb(context);
|
|
55361
55256
|
if (context.truncating && context.flags & 1 /* NoTruncation */) {
|
|
55362
55257
|
context.tracker.reportTruncationError();
|
|
55363
55258
|
}
|
|
55364
|
-
if (out) {
|
|
55365
|
-
out.couldUnfoldMore = context.couldUnfoldMore;
|
|
55366
|
-
}
|
|
55367
55259
|
return context.encounteredError ? void 0 : resultingNode;
|
|
55368
55260
|
}
|
|
55369
55261
|
function addSymbolTypeToContext(context, symbol, type) {
|
|
@@ -55382,36 +55274,16 @@ function createTypeChecker(host) {
|
|
|
55382
55274
|
function saveRestoreFlags(context) {
|
|
55383
55275
|
const flags = context.flags;
|
|
55384
55276
|
const internalFlags = context.internalFlags;
|
|
55385
|
-
const depth = context.depth;
|
|
55386
55277
|
return restore;
|
|
55387
55278
|
function restore() {
|
|
55388
55279
|
context.flags = flags;
|
|
55389
55280
|
context.internalFlags = internalFlags;
|
|
55390
|
-
context.depth = depth;
|
|
55391
55281
|
}
|
|
55392
55282
|
}
|
|
55393
55283
|
function checkTruncationLength(context) {
|
|
55394
55284
|
if (context.truncating) return context.truncating;
|
|
55395
55285
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
|
55396
55286
|
}
|
|
55397
|
-
function couldUnfoldType(type, context) {
|
|
55398
|
-
var _a;
|
|
55399
|
-
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
|
55400
|
-
return false;
|
|
55401
|
-
}
|
|
55402
|
-
return context.depth < context.unfoldDepth || context.depth === context.unfoldDepth && !context.couldUnfoldMore;
|
|
55403
|
-
}
|
|
55404
|
-
function canUnfoldType(type, context) {
|
|
55405
|
-
var _a;
|
|
55406
|
-
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
|
55407
|
-
return false;
|
|
55408
|
-
}
|
|
55409
|
-
const result = context.depth < context.unfoldDepth;
|
|
55410
|
-
if (!result) {
|
|
55411
|
-
context.couldUnfoldMore = true;
|
|
55412
|
-
}
|
|
55413
|
-
return result;
|
|
55414
|
-
}
|
|
55415
55287
|
function typeToTypeNodeHelper(type, context) {
|
|
55416
55288
|
const restoreFlags = saveRestoreFlags(context);
|
|
55417
55289
|
const typeNode = typeToTypeNodeWorker(type, context);
|
|
@@ -55559,27 +55431,16 @@ function createTypeChecker(host) {
|
|
|
55559
55431
|
return factory.createThisTypeNode();
|
|
55560
55432
|
}
|
|
55561
55433
|
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
|
55562
|
-
|
|
55563
|
-
|
|
55564
|
-
|
|
55565
|
-
|
|
55566
|
-
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
|
55567
|
-
}
|
|
55568
|
-
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
55434
|
+
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
|
55435
|
+
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
|
|
55436
|
+
if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
|
|
55437
|
+
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
|
55569
55438
|
}
|
|
55570
|
-
|
|
55439
|
+
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
|
55571
55440
|
}
|
|
55572
55441
|
const objectFlags = getObjectFlags(type);
|
|
55573
55442
|
if (objectFlags & 4 /* Reference */) {
|
|
55574
55443
|
Debug.assert(!!(type.flags & 524288 /* Object */));
|
|
55575
|
-
if (canUnfoldType(type, context)) {
|
|
55576
|
-
context.depth += 1;
|
|
55577
|
-
return createAnonymousTypeNode(
|
|
55578
|
-
type,
|
|
55579
|
-
/*forceClassExpansion*/
|
|
55580
|
-
true
|
|
55581
|
-
);
|
|
55582
|
-
}
|
|
55583
55444
|
return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
|
|
55584
55445
|
}
|
|
55585
55446
|
if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
|
|
@@ -55609,14 +55470,6 @@ function createTypeChecker(host) {
|
|
|
55609
55470
|
void 0
|
|
55610
55471
|
);
|
|
55611
55472
|
}
|
|
55612
|
-
if (objectFlags & 3 /* ClassOrInterface */ && canUnfoldType(type, context)) {
|
|
55613
|
-
context.depth += 1;
|
|
55614
|
-
return createAnonymousTypeNode(
|
|
55615
|
-
type,
|
|
55616
|
-
/*forceClassExpansion*/
|
|
55617
|
-
true
|
|
55618
|
-
);
|
|
55619
|
-
}
|
|
55620
55473
|
if (type.symbol) {
|
|
55621
55474
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
|
55622
55475
|
}
|
|
@@ -55820,7 +55673,7 @@ function createTypeChecker(host) {
|
|
|
55820
55673
|
}
|
|
55821
55674
|
return result;
|
|
55822
55675
|
}
|
|
55823
|
-
function createAnonymousTypeNode(type2
|
|
55676
|
+
function createAnonymousTypeNode(type2) {
|
|
55824
55677
|
var _a2, _b2;
|
|
55825
55678
|
const typeId = type2.id;
|
|
55826
55679
|
const symbol = type2.symbol;
|
|
@@ -55843,7 +55696,7 @@ function createTypeChecker(host) {
|
|
|
55843
55696
|
const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
|
|
55844
55697
|
if (isJSConstructor(symbol.valueDeclaration)) {
|
|
55845
55698
|
return symbolToTypeNode(symbol, context, isInstanceType);
|
|
55846
|
-
} else if (symbol.flags & 32 /* Class */ && !
|
|
55699
|
+
} else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
|
55847
55700
|
symbol,
|
|
55848
55701
|
context.enclosingDeclaration,
|
|
55849
55702
|
isInstanceType,
|
|
@@ -55887,7 +55740,7 @@ function createTypeChecker(host) {
|
|
|
55887
55740
|
if (id && !context.symbolDepth) {
|
|
55888
55741
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
|
55889
55742
|
}
|
|
55890
|
-
const links = context.
|
|
55743
|
+
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
|
55891
55744
|
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
|
55892
55745
|
if (links) {
|
|
55893
55746
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
@@ -56834,7 +56687,7 @@ function createTypeChecker(host) {
|
|
|
56834
56687
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
|
56835
56688
|
}
|
|
56836
56689
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
|
56837
|
-
return
|
|
56690
|
+
return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
|
56838
56691
|
}
|
|
56839
56692
|
function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
|
|
56840
56693
|
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
|
|
@@ -57481,7 +57334,7 @@ function createTypeChecker(host) {
|
|
|
57481
57334
|
let result;
|
|
57482
57335
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
|
57483
57336
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
57484
|
-
if (
|
|
57337
|
+
if (decl) {
|
|
57485
57338
|
if (isAccessor(decl)) {
|
|
57486
57339
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
|
57487
57340
|
} else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
|
|
@@ -64193,14 +64046,11 @@ function createTypeChecker(host) {
|
|
|
64193
64046
|
function isNoInferType(type) {
|
|
64194
64047
|
return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
|
|
64195
64048
|
}
|
|
64196
|
-
function
|
|
64197
|
-
return
|
|
64049
|
+
function getSubstitutionType(baseType, constraint) {
|
|
64050
|
+
return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
|
|
64198
64051
|
}
|
|
64199
|
-
function
|
|
64200
|
-
|
|
64201
|
-
}
|
|
64202
|
-
function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
|
|
64203
|
-
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
|
|
64052
|
+
function getOrCreateSubstitutionType(baseType, constraint) {
|
|
64053
|
+
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
64204
64054
|
const cached = substitutionTypes.get(id);
|
|
64205
64055
|
if (cached) {
|
|
64206
64056
|
return cached;
|
|
@@ -64208,9 +64058,6 @@ function createTypeChecker(host) {
|
|
|
64208
64058
|
const result = createType(33554432 /* Substitution */);
|
|
64209
64059
|
result.baseType = baseType;
|
|
64210
64060
|
result.constraint = constraint;
|
|
64211
|
-
if (isNarrowed) {
|
|
64212
|
-
result.objectFlags |= 16777216 /* IsNarrowingType */;
|
|
64213
|
-
}
|
|
64214
64061
|
substitutionTypes.set(id, result);
|
|
64215
64062
|
return result;
|
|
64216
64063
|
}
|
|
@@ -66416,7 +66263,7 @@ function createTypeChecker(host) {
|
|
|
66416
66263
|
function isDeferredType(type, checkTuples) {
|
|
66417
66264
|
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
|
66418
66265
|
}
|
|
66419
|
-
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments
|
|
66266
|
+
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
|
|
66420
66267
|
let result;
|
|
66421
66268
|
let extraTypes;
|
|
66422
66269
|
let tailCount = 0;
|
|
@@ -66433,11 +66280,10 @@ function createTypeChecker(host) {
|
|
|
66433
66280
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
66434
66281
|
return wildcardType;
|
|
66435
66282
|
}
|
|
66436
|
-
const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
|
|
66437
66283
|
const checkTypeNode = skipTypeParentheses(root.node.checkType);
|
|
66438
66284
|
const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
|
|
66439
66285
|
const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
|
|
66440
|
-
const checkTypeDeferred = isDeferredType(
|
|
66286
|
+
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
66441
66287
|
let combinedMapper;
|
|
66442
66288
|
if (root.inferTypeParameters) {
|
|
66443
66289
|
const context = createInferenceContext(
|
|
@@ -66456,8 +66302,8 @@ function createTypeChecker(host) {
|
|
|
66456
66302
|
}
|
|
66457
66303
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
66458
66304
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
66459
|
-
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (
|
|
66460
|
-
if (
|
|
66305
|
+
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
|
|
66306
|
+
if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
|
|
66461
66307
|
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
|
66462
66308
|
}
|
|
66463
66309
|
const falseType2 = getTypeFromTypeNode(root.node.falseType);
|
|
@@ -66474,7 +66320,7 @@ function createTypeChecker(host) {
|
|
|
66474
66320
|
result = instantiateType(falseType2, mapper);
|
|
66475
66321
|
break;
|
|
66476
66322
|
}
|
|
66477
|
-
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(
|
|
66323
|
+
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
|
|
66478
66324
|
const trueType2 = getTypeFromTypeNode(root.node.trueType);
|
|
66479
66325
|
const trueMapper = combinedMapper || mapper;
|
|
66480
66326
|
if (canTailRecurse(trueType2, trueMapper)) {
|
|
@@ -67440,39 +67286,8 @@ function createTypeChecker(host) {
|
|
|
67440
67286
|
if (!result) {
|
|
67441
67287
|
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
|
67442
67288
|
const checkType = root.checkType;
|
|
67443
|
-
|
|
67444
|
-
|
|
67445
|
-
const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(type, mapper);
|
|
67446
|
-
if (forNarrowing) {
|
|
67447
|
-
narrowingBaseType = distributionType.baseType;
|
|
67448
|
-
distributionType = getReducedType(distributionType.constraint);
|
|
67449
|
-
}
|
|
67450
|
-
if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
|
|
67451
|
-
if (narrowingBaseType) {
|
|
67452
|
-
result = mapTypeToIntersection(
|
|
67453
|
-
distributionType,
|
|
67454
|
-
(t) => getConditionalType(
|
|
67455
|
-
root,
|
|
67456
|
-
prependTypeMapping(checkType, getSubstitutionType(
|
|
67457
|
-
narrowingBaseType,
|
|
67458
|
-
t,
|
|
67459
|
-
/*isNarrowed*/
|
|
67460
|
-
true
|
|
67461
|
-
), newMapper),
|
|
67462
|
-
forConstraint,
|
|
67463
|
-
/*aliasSymbol*/
|
|
67464
|
-
void 0,
|
|
67465
|
-
/*aliasTypeArguments*/
|
|
67466
|
-
void 0,
|
|
67467
|
-
forNarrowing
|
|
67468
|
-
)
|
|
67469
|
-
);
|
|
67470
|
-
} else {
|
|
67471
|
-
result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
|
|
67472
|
-
}
|
|
67473
|
-
} else {
|
|
67474
|
-
result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
|
|
67475
|
-
}
|
|
67289
|
+
const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
|
|
67290
|
+
result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
|
|
67476
67291
|
root.instantiations.set(id, result);
|
|
67477
67292
|
}
|
|
67478
67293
|
return result;
|
|
@@ -68615,12 +68430,10 @@ function createTypeChecker(host) {
|
|
|
68615
68430
|
function shouldNormalizeIntersection(type) {
|
|
68616
68431
|
let hasInstantiable = false;
|
|
68617
68432
|
let hasNullableOrEmpty = false;
|
|
68618
|
-
let hasSubstitution = false;
|
|
68619
68433
|
for (const t of type.types) {
|
|
68620
68434
|
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
|
68621
68435
|
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
|
68622
|
-
|
|
68623
|
-
if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
|
|
68436
|
+
if (hasInstantiable && hasNullableOrEmpty) return true;
|
|
68624
68437
|
}
|
|
68625
68438
|
return false;
|
|
68626
68439
|
}
|
|
@@ -73780,18 +73593,6 @@ function createTypeChecker(host) {
|
|
|
73780
73593
|
}
|
|
73781
73594
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
|
73782
73595
|
}
|
|
73783
|
-
function mapTypeToIntersection(type, mapper) {
|
|
73784
|
-
if (type.flags & 131072 /* Never */) {
|
|
73785
|
-
return type;
|
|
73786
|
-
}
|
|
73787
|
-
if (!(type.flags & 1048576 /* Union */)) {
|
|
73788
|
-
return mapper(type);
|
|
73789
|
-
}
|
|
73790
|
-
const origin = type.origin;
|
|
73791
|
-
const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
73792
|
-
const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
|
|
73793
|
-
return getIntersectionType(mappedTypes);
|
|
73794
|
-
}
|
|
73795
73596
|
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
73796
73597
|
return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
|
|
73797
73598
|
}
|
|
@@ -75376,11 +75177,11 @@ function createTypeChecker(host) {
|
|
|
75376
75177
|
));
|
|
75377
75178
|
return contextualType && !isGenericType(contextualType);
|
|
75378
75179
|
}
|
|
75379
|
-
function getNarrowableTypeForReference(type, reference, checkMode
|
|
75180
|
+
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
75380
75181
|
if (isNoInferType(type)) {
|
|
75381
75182
|
type = type.baseType;
|
|
75382
75183
|
}
|
|
75383
|
-
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (
|
|
75184
|
+
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
75384
75185
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
75385
75186
|
}
|
|
75386
75187
|
function isExportOrExportExpression(location) {
|
|
@@ -76507,16 +76308,9 @@ function createTypeChecker(host) {
|
|
|
76507
76308
|
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
76508
76309
|
const func = getContainingFunction(node);
|
|
76509
76310
|
if (func) {
|
|
76510
|
-
const functionFlags = getFunctionFlags(func);
|
|
76511
|
-
const links = getNodeLinks(node);
|
|
76512
|
-
if (links.contextualReturnType) {
|
|
76513
|
-
if (functionFlags & 2 /* Async */) {
|
|
76514
|
-
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
|
76515
|
-
}
|
|
76516
|
-
return links.contextualReturnType;
|
|
76517
|
-
}
|
|
76518
76311
|
let contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
76519
76312
|
if (contextualReturnType) {
|
|
76313
|
+
const functionFlags = getFunctionFlags(func);
|
|
76520
76314
|
if (functionFlags & 1 /* Generator */) {
|
|
76521
76315
|
const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
|
|
76522
76316
|
if (contextualReturnType.flags & 1048576 /* Union */) {
|
|
@@ -77214,13 +77008,6 @@ function createTypeChecker(host) {
|
|
|
77214
77008
|
if (index >= 0) {
|
|
77215
77009
|
return contextualTypes[index];
|
|
77216
77010
|
}
|
|
77217
|
-
const links = getNodeLinks(node);
|
|
77218
|
-
if (links.contextualReturnType) {
|
|
77219
|
-
if (node.flags & 65536 /* AwaitContext */) {
|
|
77220
|
-
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
|
77221
|
-
}
|
|
77222
|
-
return links.contextualReturnType;
|
|
77223
|
-
}
|
|
77224
77011
|
const { parent: parent2 } = node;
|
|
77225
77012
|
switch (parent2.kind) {
|
|
77226
77013
|
case 260 /* VariableDeclaration */:
|
|
@@ -88209,199 +87996,7 @@ function createTypeChecker(host) {
|
|
|
88209
87996
|
) : exprType;
|
|
88210
87997
|
const effectiveExpr = expr && getEffectiveCheckNode(expr);
|
|
88211
87998
|
const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
|
|
88212
|
-
|
|
88213
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
|
88214
|
-
return;
|
|
88215
|
-
}
|
|
88216
|
-
if (checkTypeAssignableTo(
|
|
88217
|
-
unwrappedExprType,
|
|
88218
|
-
unwrappedReturnType,
|
|
88219
|
-
/*errorNode*/
|
|
88220
|
-
void 0
|
|
88221
|
-
)) {
|
|
88222
|
-
return;
|
|
88223
|
-
}
|
|
88224
|
-
let narrowPosition = node;
|
|
88225
|
-
let narrowFlowNode = inReturnStatement && node.flowNode;
|
|
88226
|
-
if (expr && isConditionalExpression(expr.parent)) {
|
|
88227
|
-
narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
|
|
88228
|
-
narrowPosition = expr;
|
|
88229
|
-
}
|
|
88230
|
-
if (!narrowFlowNode) {
|
|
88231
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
|
88232
|
-
return;
|
|
88233
|
-
}
|
|
88234
|
-
const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
|
|
88235
|
-
container,
|
|
88236
|
-
/*includeThisTypes*/
|
|
88237
|
-
false
|
|
88238
|
-
), getEffectiveTypeParameterDeclarations(container));
|
|
88239
|
-
const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
|
|
88240
|
-
if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
|
|
88241
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
|
88242
|
-
return;
|
|
88243
|
-
}
|
|
88244
|
-
const narrowedTypeParameters = [];
|
|
88245
|
-
const narrowedTypes = [];
|
|
88246
|
-
for (const [typeParam, symbol, reference] of narrowableTypeParameters) {
|
|
88247
|
-
const narrowReference = factory.cloneNode(reference);
|
|
88248
|
-
narrowReference.id = void 0;
|
|
88249
|
-
getNodeLinks(narrowReference).resolvedSymbol = symbol;
|
|
88250
|
-
setParent(narrowReference, narrowPosition.parent);
|
|
88251
|
-
narrowReference.flowNode = narrowFlowNode;
|
|
88252
|
-
const initialType = getNarrowableTypeForReference(
|
|
88253
|
-
typeParam,
|
|
88254
|
-
narrowReference,
|
|
88255
|
-
/*checkMode*/
|
|
88256
|
-
void 0,
|
|
88257
|
-
/*forReturnTypeNarrowing*/
|
|
88258
|
-
true
|
|
88259
|
-
);
|
|
88260
|
-
if (initialType === typeParam) {
|
|
88261
|
-
continue;
|
|
88262
|
-
}
|
|
88263
|
-
const flowType = getFlowTypeOfReference(narrowReference, initialType);
|
|
88264
|
-
const exprType2 = getTypeFromFlowType(flowType);
|
|
88265
|
-
if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
|
|
88266
|
-
continue;
|
|
88267
|
-
}
|
|
88268
|
-
const narrowedType = getSubstitutionType(
|
|
88269
|
-
typeParam,
|
|
88270
|
-
exprType2,
|
|
88271
|
-
/*isNarrowed*/
|
|
88272
|
-
true
|
|
88273
|
-
);
|
|
88274
|
-
narrowedTypeParameters.push(typeParam);
|
|
88275
|
-
narrowedTypes.push(narrowedType);
|
|
88276
|
-
}
|
|
88277
|
-
const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
|
|
88278
|
-
const narrowedReturnType = instantiateType(
|
|
88279
|
-
unwrappedReturnType,
|
|
88280
|
-
narrowMapper
|
|
88281
|
-
);
|
|
88282
|
-
if (expr) {
|
|
88283
|
-
const links = getNodeLinks(expr);
|
|
88284
|
-
if (!links.contextualReturnType) {
|
|
88285
|
-
links.contextualReturnType = narrowedReturnType;
|
|
88286
|
-
}
|
|
88287
|
-
}
|
|
88288
|
-
const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
|
|
88289
|
-
const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
|
88290
|
-
narrowedExprType,
|
|
88291
|
-
/*withAlias*/
|
|
88292
|
-
false,
|
|
88293
|
-
node,
|
|
88294
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
88295
|
-
) : narrowedExprType;
|
|
88296
|
-
checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
|
|
88297
|
-
}
|
|
88298
|
-
function getNarrowableTypeParameters(candidates) {
|
|
88299
|
-
const narrowableParams = [];
|
|
88300
|
-
for (const typeParam of candidates) {
|
|
88301
|
-
const constraint = getConstraintOfTypeParameter(typeParam);
|
|
88302
|
-
if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
|
|
88303
|
-
if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
|
|
88304
|
-
const declaration = typeParam.symbol.declarations[0];
|
|
88305
|
-
const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
|
|
88306
|
-
if (!isFunctionLike(container)) continue;
|
|
88307
|
-
let reference;
|
|
88308
|
-
let hasInvalidReference = false;
|
|
88309
|
-
for (const paramDecl of container.parameters) {
|
|
88310
|
-
const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
|
|
88311
|
-
if (!typeNode) continue;
|
|
88312
|
-
if (isTypeParameterReferenced(typeParam, typeNode)) {
|
|
88313
|
-
let candidateReference;
|
|
88314
|
-
if (isTypeReferenceNode(typeNode) && isReferenceToTypeParameter(typeParam, typeNode) && (candidateReference = getValidParameterReference(paramDecl, constraint))) {
|
|
88315
|
-
if (reference) {
|
|
88316
|
-
hasInvalidReference = true;
|
|
88317
|
-
break;
|
|
88318
|
-
}
|
|
88319
|
-
reference = candidateReference;
|
|
88320
|
-
} else {
|
|
88321
|
-
hasInvalidReference = true;
|
|
88322
|
-
break;
|
|
88323
|
-
}
|
|
88324
|
-
}
|
|
88325
|
-
}
|
|
88326
|
-
if (!hasInvalidReference && reference) {
|
|
88327
|
-
const symbol = getResolvedSymbol(reference);
|
|
88328
|
-
if (symbol !== unknownSymbol) narrowableParams.push([typeParam, symbol, reference]);
|
|
88329
|
-
}
|
|
88330
|
-
}
|
|
88331
|
-
}
|
|
88332
|
-
return narrowableParams;
|
|
88333
|
-
function getValidParameterReference(paramDecl, constraint) {
|
|
88334
|
-
if (!isIdentifier(paramDecl.name)) return;
|
|
88335
|
-
const isOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
|
|
88336
|
-
if (isOptional && !containsUndefinedType(constraint)) return;
|
|
88337
|
-
return paramDecl.name;
|
|
88338
|
-
}
|
|
88339
|
-
function isReferenceToTypeParameter(typeParam, node) {
|
|
88340
|
-
return getTypeFromTypeReference(node) === typeParam;
|
|
88341
|
-
}
|
|
88342
|
-
function isTypeParameterReferenced(typeParam, node) {
|
|
88343
|
-
return isReferenced(node);
|
|
88344
|
-
function isReferenced(node2) {
|
|
88345
|
-
if (isTypeReferenceNode(node2)) {
|
|
88346
|
-
return isReferenceToTypeParameter(typeParam, node2);
|
|
88347
|
-
}
|
|
88348
|
-
if (isTypeQueryNode(node2)) {
|
|
88349
|
-
return isTypeParameterPossiblyReferenced(typeParam, node2);
|
|
88350
|
-
}
|
|
88351
|
-
return !!forEachChild(node2, isReferenced);
|
|
88352
|
-
}
|
|
88353
|
-
}
|
|
88354
|
-
}
|
|
88355
|
-
function isNarrowableReturnType(returnType) {
|
|
88356
|
-
return isConditionalType(returnType) ? isNarrowableConditionalType(returnType) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
|
|
88357
|
-
}
|
|
88358
|
-
function isNarrowableConditionalType(type, mapper) {
|
|
88359
|
-
const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
|
|
88360
|
-
const mapped = getMappedType(t, mapper);
|
|
88361
|
-
if (isNarrowingSubstitutionType(mapped)) {
|
|
88362
|
-
return mapped.baseType;
|
|
88363
|
-
}
|
|
88364
|
-
return mapped;
|
|
88365
|
-
});
|
|
88366
|
-
const id = `${type.id}:${getTypeListId(typeArguments)}`;
|
|
88367
|
-
let result = narrowableReturnTypeCache.get(id);
|
|
88368
|
-
if (result === void 0) {
|
|
88369
|
-
const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
|
|
88370
|
-
const instantiatedType = instantiateType(type, nonNarrowingMapper);
|
|
88371
|
-
result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType);
|
|
88372
|
-
narrowableReturnTypeCache.set(id, result);
|
|
88373
|
-
}
|
|
88374
|
-
return result;
|
|
88375
|
-
}
|
|
88376
|
-
function isNarrowableConditionalTypeWorker(type) {
|
|
88377
|
-
if (!type.root.isDistributive) {
|
|
88378
|
-
return false;
|
|
88379
|
-
}
|
|
88380
|
-
if (type.root.inferTypeParameters) {
|
|
88381
|
-
return false;
|
|
88382
|
-
}
|
|
88383
|
-
if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
88384
|
-
return false;
|
|
88385
|
-
}
|
|
88386
|
-
const constraintType = getConstraintOfTypeParameter(type.checkType);
|
|
88387
|
-
if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
|
|
88388
|
-
return false;
|
|
88389
|
-
}
|
|
88390
|
-
if (!everyType(type.extendsType, (extendsType) => some(
|
|
88391
|
-
constraintType.types,
|
|
88392
|
-
(constraintType2) => isTypeIdenticalTo(constraintType2, extendsType)
|
|
88393
|
-
))) {
|
|
88394
|
-
return false;
|
|
88395
|
-
}
|
|
88396
|
-
const trueType2 = getTrueTypeFromConditionalType(type);
|
|
88397
|
-
const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2) : true;
|
|
88398
|
-
if (!isValidTrueType) return false;
|
|
88399
|
-
const falseType2 = getFalseTypeFromConditionalType(type);
|
|
88400
|
-
const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2) : falseType2 === neverType;
|
|
88401
|
-
return isValidFalseType;
|
|
88402
|
-
}
|
|
88403
|
-
function isConditionalType(type) {
|
|
88404
|
-
return !!(type.flags & 16777216 /* Conditional */);
|
|
87999
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
|
88405
88000
|
}
|
|
88406
88001
|
function checkWithStatement(node) {
|
|
88407
88002
|
if (!checkGrammarStatementInAmbientContext(node)) {
|
|
@@ -90011,7 +89606,7 @@ function createTypeChecker(host) {
|
|
|
90011
89606
|
);
|
|
90012
89607
|
}
|
|
90013
89608
|
if (moduleKind === 199 /* NodeNext */ && !isImportAttributes2) {
|
|
90014
|
-
return grammarErrorOnFirstToken(node, Diagnostics.
|
|
89609
|
+
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
|
|
90015
89610
|
}
|
|
90016
89611
|
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
|
|
90017
89612
|
return grammarErrorOnNode(
|
|
@@ -90078,11 +89673,10 @@ function createTypeChecker(host) {
|
|
|
90078
89673
|
return;
|
|
90079
89674
|
}
|
|
90080
89675
|
checkGrammarModifiers(node);
|
|
90081
|
-
|
|
90082
|
-
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
|
89676
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
90083
89677
|
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
|
90084
89678
|
}
|
|
90085
|
-
if (
|
|
89679
|
+
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
90086
89680
|
checkImportBinding(node);
|
|
90087
89681
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
|
90088
89682
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
@@ -90202,6 +89796,9 @@ function createTypeChecker(host) {
|
|
|
90202
89796
|
if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
|
|
90203
89797
|
return;
|
|
90204
89798
|
}
|
|
89799
|
+
if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
|
89800
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
|
89801
|
+
}
|
|
90205
89802
|
const container = node.parent.kind === 307 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
90206
89803
|
if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
90207
89804
|
if (node.isExportEquals) {
|
|
@@ -91199,7 +90796,7 @@ function createTypeChecker(host) {
|
|
|
91199
90796
|
name,
|
|
91200
90797
|
meaning,
|
|
91201
90798
|
/*ignoreErrors*/
|
|
91202
|
-
|
|
90799
|
+
true,
|
|
91203
90800
|
/*dontResolveAlias*/
|
|
91204
90801
|
true
|
|
91205
90802
|
);
|
|
@@ -91209,7 +90806,9 @@ function createTypeChecker(host) {
|
|
|
91209
90806
|
return resolveEntityName(
|
|
91210
90807
|
name,
|
|
91211
90808
|
/*meaning*/
|
|
91212
|
-
1 /* FunctionScopedVariable
|
|
90809
|
+
1 /* FunctionScopedVariable */,
|
|
90810
|
+
/*ignoreErrors*/
|
|
90811
|
+
true
|
|
91213
90812
|
);
|
|
91214
90813
|
}
|
|
91215
90814
|
return void 0;
|
|
@@ -91394,7 +90993,12 @@ function createTypeChecker(host) {
|
|
|
91394
90993
|
}
|
|
91395
90994
|
function getShorthandAssignmentValueSymbol(location) {
|
|
91396
90995
|
if (location && location.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
91397
|
-
return resolveEntityName(
|
|
90996
|
+
return resolveEntityName(
|
|
90997
|
+
location.name,
|
|
90998
|
+
111551 /* Value */ | 2097152 /* Alias */,
|
|
90999
|
+
/*ignoreErrors*/
|
|
91000
|
+
true
|
|
91001
|
+
);
|
|
91398
91002
|
}
|
|
91399
91003
|
return void 0;
|
|
91400
91004
|
}
|
|
@@ -91403,10 +91007,20 @@ function createTypeChecker(host) {
|
|
|
91403
91007
|
const name = node.propertyName || node.name;
|
|
91404
91008
|
return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
|
|
91405
91009
|
// Skip for invalid syntax like this: export { "x" }
|
|
91406
|
-
resolveEntityName(
|
|
91010
|
+
resolveEntityName(
|
|
91011
|
+
name,
|
|
91012
|
+
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
91013
|
+
/*ignoreErrors*/
|
|
91014
|
+
true
|
|
91015
|
+
)
|
|
91407
91016
|
);
|
|
91408
91017
|
} else {
|
|
91409
|
-
return resolveEntityName(
|
|
91018
|
+
return resolveEntityName(
|
|
91019
|
+
node,
|
|
91020
|
+
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
91021
|
+
/*ignoreErrors*/
|
|
91022
|
+
true
|
|
91023
|
+
);
|
|
91410
91024
|
}
|
|
91411
91025
|
}
|
|
91412
91026
|
function getTypeOfNode(node) {
|
|
@@ -117054,7 +116668,7 @@ function transformECMAScriptModule(context) {
|
|
|
117054
116668
|
if (node === (importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim[0])) {
|
|
117055
116669
|
return visitImportOrRequireCall(importsAndRequiresToRewriteOrShim.shift());
|
|
117056
116670
|
}
|
|
117057
|
-
|
|
116671
|
+
// fallthrough
|
|
117058
116672
|
default:
|
|
117059
116673
|
if ((importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length) && rangeContainsRange(node, importsAndRequiresToRewriteOrShim[0])) {
|
|
117060
116674
|
return visitEachChild(node, visitor, context);
|
|
@@ -140640,9 +140254,9 @@ function mapToDisplayParts(writeDisplayParts) {
|
|
|
140640
140254
|
displayPartWriter.clear();
|
|
140641
140255
|
}
|
|
140642
140256
|
}
|
|
140643
|
-
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None
|
|
140257
|
+
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None */) {
|
|
140644
140258
|
return mapToDisplayParts((writer) => {
|
|
140645
|
-
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer
|
|
140259
|
+
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer);
|
|
140646
140260
|
});
|
|
140647
140261
|
}
|
|
140648
140262
|
function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags = 0 /* None */) {
|
|
@@ -147254,7 +146868,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
|
|
|
147254
146868
|
const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
|
|
147255
146869
|
for (const statement of toMove) {
|
|
147256
146870
|
forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
|
|
147257
|
-
if (!symbol.declarations) {
|
|
146871
|
+
if (!some(symbol.declarations)) {
|
|
147258
146872
|
return;
|
|
147259
146873
|
}
|
|
147260
146874
|
if (existingTargetLocals.has(skipAlias(symbol, checker))) {
|
|
@@ -152607,7 +152221,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
152607
152221
|
synchronizeHostData();
|
|
152608
152222
|
return ts_Completions_exports.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences);
|
|
152609
152223
|
}
|
|
152610
|
-
function getQuickInfoAtPosition(fileName, position
|
|
152224
|
+
function getQuickInfoAtPosition(fileName, position) {
|
|
152611
152225
|
synchronizeHostData();
|
|
152612
152226
|
const sourceFile = getValidSourceFile(fileName);
|
|
152613
152227
|
const node = getTouchingPropertyName(sourceFile, position);
|
|
@@ -152623,41 +152237,19 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
152623
152237
|
kind: "" /* unknown */,
|
|
152624
152238
|
kindModifiers: "" /* none */,
|
|
152625
152239
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
|
152626
|
-
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
|
|
152627
|
-
typeChecker2,
|
|
152628
|
-
type,
|
|
152629
|
-
getContainerNode(nodeForQuickInfo),
|
|
152630
|
-
/*flags*/
|
|
152631
|
-
void 0,
|
|
152632
|
-
verbosityLevel
|
|
152633
|
-
)),
|
|
152240
|
+
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(typeChecker2, type, getContainerNode(nodeForQuickInfo))),
|
|
152634
152241
|
documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : void 0,
|
|
152635
152242
|
tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : void 0
|
|
152636
152243
|
};
|
|
152637
152244
|
}
|
|
152638
|
-
const { symbolKind, displayParts, documentation, tags
|
|
152639
|
-
cancellationToken,
|
|
152640
|
-
(typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(
|
|
152641
|
-
typeChecker2,
|
|
152642
|
-
symbol,
|
|
152643
|
-
sourceFile,
|
|
152644
|
-
getContainerNode(nodeForQuickInfo),
|
|
152645
|
-
nodeForQuickInfo,
|
|
152646
|
-
/*semanticMeaning*/
|
|
152647
|
-
void 0,
|
|
152648
|
-
/*alias*/
|
|
152649
|
-
void 0,
|
|
152650
|
-
verbosityLevel
|
|
152651
|
-
)
|
|
152652
|
-
);
|
|
152245
|
+
const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker2, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo));
|
|
152653
152246
|
return {
|
|
152654
152247
|
kind: symbolKind,
|
|
152655
152248
|
kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
|
|
152656
152249
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
|
152657
152250
|
displayParts,
|
|
152658
152251
|
documentation,
|
|
152659
|
-
tags
|
|
152660
|
-
canIncreaseVerbosityLevel
|
|
152252
|
+
tags
|
|
152661
152253
|
};
|
|
152662
152254
|
}
|
|
152663
152255
|
function preparePasteEditsForFile(fileName, copiedTextRange) {
|
|
@@ -177733,7 +177325,7 @@ function getSymbolModifiers(typeChecker, symbol) {
|
|
|
177733
177325
|
}
|
|
177734
177326
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
|
177735
177327
|
}
|
|
177736
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias
|
|
177328
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
|
177737
177329
|
var _a;
|
|
177738
177330
|
const displayParts = [];
|
|
177739
177331
|
let documentation = [];
|
|
@@ -177745,7 +177337,6 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
177745
177337
|
let documentationFromAlias;
|
|
177746
177338
|
let tagsFromAlias;
|
|
177747
177339
|
let hasMultipleSignatures = false;
|
|
177748
|
-
const typeWriterOut = verbosityLevel !== void 0 ? { couldUnfoldMore: false } : void 0;
|
|
177749
177340
|
if (location.kind === 110 /* ThisKeyword */ && !isThisExpression) {
|
|
177750
177341
|
return { displayParts: [keywordPart(110 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 };
|
|
177751
177342
|
}
|
|
@@ -177905,17 +177496,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
177905
177496
|
displayParts.push(spacePart());
|
|
177906
177497
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
|
177907
177498
|
displayParts.push(spacePart());
|
|
177908
|
-
addRange(
|
|
177909
|
-
displayParts,
|
|
177910
|
-
typeToDisplayParts(
|
|
177911
|
-
typeChecker,
|
|
177912
|
-
location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol),
|
|
177913
|
-
enclosingDeclaration,
|
|
177914
|
-
8388608 /* InTypeAlias */,
|
|
177915
|
-
verbosityLevel,
|
|
177916
|
-
typeWriterOut
|
|
177917
|
-
)
|
|
177918
|
-
);
|
|
177499
|
+
addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
177919
177500
|
}
|
|
177920
177501
|
if (symbolFlags & 384 /* Enum */) {
|
|
177921
177502
|
prefixNextMeaning();
|
|
@@ -178074,32 +177655,12 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
178074
177655
|
displayParts.push(spacePart());
|
|
178075
177656
|
if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) {
|
|
178076
177657
|
const typeParameterParts = mapToDisplayParts((writer) => {
|
|
178077
|
-
const param = typeChecker.typeParameterToDeclaration(
|
|
178078
|
-
type,
|
|
178079
|
-
enclosingDeclaration,
|
|
178080
|
-
symbolDisplayNodeBuilderFlags,
|
|
178081
|
-
/*internalFlags*/
|
|
178082
|
-
void 0,
|
|
178083
|
-
/*tracker*/
|
|
178084
|
-
void 0,
|
|
178085
|
-
verbosityLevel
|
|
178086
|
-
);
|
|
177658
|
+
const param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags);
|
|
178087
177659
|
getPrinter().writeNode(4 /* Unspecified */, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
|
|
178088
177660
|
});
|
|
178089
177661
|
addRange(displayParts, typeParameterParts);
|
|
178090
177662
|
} else {
|
|
178091
|
-
addRange(
|
|
178092
|
-
displayParts,
|
|
178093
|
-
typeToDisplayParts(
|
|
178094
|
-
typeChecker,
|
|
178095
|
-
type,
|
|
178096
|
-
enclosingDeclaration,
|
|
178097
|
-
/*flags*/
|
|
178098
|
-
void 0,
|
|
178099
|
-
verbosityLevel,
|
|
178100
|
-
typeWriterOut
|
|
178101
|
-
)
|
|
178102
|
-
);
|
|
177663
|
+
addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration));
|
|
178103
177664
|
}
|
|
178104
177665
|
if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) {
|
|
178105
177666
|
const labelDecl = symbol.links.target.links.tupleLabelDeclaration;
|
|
@@ -178164,13 +177725,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
178164
177725
|
if (tags.length === 0 && tagsFromAlias) {
|
|
178165
177726
|
tags = tagsFromAlias;
|
|
178166
177727
|
}
|
|
178167
|
-
return {
|
|
178168
|
-
displayParts,
|
|
178169
|
-
documentation,
|
|
178170
|
-
symbolKind,
|
|
178171
|
-
tags: tags.length === 0 ? void 0 : tags,
|
|
178172
|
-
canIncreaseVerbosityLevel: typeWriterOut == null ? void 0 : typeWriterOut.couldUnfoldMore
|
|
178173
|
-
};
|
|
177728
|
+
return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
|
|
178174
177729
|
function getPrinter() {
|
|
178175
177730
|
return createPrinterWithRemoveComments();
|
|
178176
177731
|
}
|
|
@@ -178283,7 +177838,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
178283
177838
|
addRange(displayParts, typeParameterParts);
|
|
178284
177839
|
}
|
|
178285
177840
|
}
|
|
178286
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias
|
|
177841
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
|
178287
177842
|
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
178288
177843
|
typeChecker,
|
|
178289
177844
|
symbol,
|
|
@@ -178293,8 +177848,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
178293
177848
|
/*type*/
|
|
178294
177849
|
void 0,
|
|
178295
177850
|
semanticMeaning,
|
|
178296
|
-
alias
|
|
178297
|
-
verbosityLevel
|
|
177851
|
+
alias
|
|
178298
177852
|
);
|
|
178299
177853
|
}
|
|
178300
177854
|
function isLocalVariableOrFunction(symbol) {
|
|
@@ -195244,7 +194798,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
195244
194798
|
getQuickInfoWorker(args, simplifiedResult) {
|
|
195245
194799
|
const { file, project } = this.getFileAndProject(args);
|
|
195246
194800
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
|
195247
|
-
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)
|
|
194801
|
+
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo));
|
|
195248
194802
|
if (!quickInfo) {
|
|
195249
194803
|
return void 0;
|
|
195250
194804
|
}
|
|
@@ -195258,8 +194812,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
195258
194812
|
end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)),
|
|
195259
194813
|
displayString,
|
|
195260
194814
|
documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation),
|
|
195261
|
-
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts)
|
|
195262
|
-
canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel
|
|
194815
|
+
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts)
|
|
195263
194816
|
};
|
|
195264
194817
|
} else {
|
|
195265
194818
|
return useDisplayParts ? quickInfo : {
|