typescript 4.5.0-dev.20211031 → 4.6.0-dev.20211103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es5.d.ts +1 -1
- package/lib/tsc.js +145 -82
- package/lib/tsserver.js +199 -104
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +199 -104
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +199 -104
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +199 -104
- package/lib/typingsInstaller.js +197 -103
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
package/lib/tsc.js
CHANGED
|
@@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
68
68
|
};
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
|
-
ts.versionMajorMinor = "4.
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
71
|
+
ts.versionMajorMinor = "4.6";
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211103";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -5307,7 +5307,7 @@ var ts;
|
|
|
5307
5307
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
5308
5308
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
5309
5309
|
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
|
|
5310
|
-
|
|
5310
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
5311
5311
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
5312
5312
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
5313
5313
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -5907,11 +5907,12 @@ var ts;
|
|
|
5907
5907
|
Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
|
|
5908
5908
|
Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
5909
5909
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
5910
|
-
|
|
5910
|
+
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
5911
5911
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
5912
5912
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
5913
5913
|
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
|
|
5914
5914
|
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
|
|
5915
|
+
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
5915
5916
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
5916
5917
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.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}'."),
|
|
5917
5918
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.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}'."),
|
|
@@ -8720,6 +8721,7 @@ var ts;
|
|
|
8720
8721
|
tokenValue = tokenValue.slice(0, -1);
|
|
8721
8722
|
pos--;
|
|
8722
8723
|
}
|
|
8724
|
+
return getIdentifierToken();
|
|
8723
8725
|
}
|
|
8724
8726
|
return token;
|
|
8725
8727
|
}
|
|
@@ -44623,11 +44625,14 @@ var ts;
|
|
|
44623
44625
|
return type.flags & (128 | 256) ? "" + type.value : undefined;
|
|
44624
44626
|
}
|
|
44625
44627
|
function getTypeForBindingElement(declaration) {
|
|
44626
|
-
var
|
|
44627
|
-
|
|
44628
|
-
|
|
44628
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent);
|
|
44629
|
+
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
44630
|
+
}
|
|
44631
|
+
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
44632
|
+
if (isTypeAny(parentType)) {
|
|
44629
44633
|
return parentType;
|
|
44630
44634
|
}
|
|
44635
|
+
var pattern = declaration.parent;
|
|
44631
44636
|
if (strictNullChecks && declaration.flags & 8388608 && ts.isParameterDeclaration(declaration)) {
|
|
44632
44637
|
parentType = getNonNullableType(parentType);
|
|
44633
44638
|
}
|
|
@@ -49208,6 +49213,8 @@ var ts;
|
|
|
49208
49213
|
}
|
|
49209
49214
|
if (!(flags & 131072)) {
|
|
49210
49215
|
includes |= flags & 205258751;
|
|
49216
|
+
if (flags & 465829888)
|
|
49217
|
+
includes |= 33554432;
|
|
49211
49218
|
if (type === wildcardType)
|
|
49212
49219
|
includes |= 8388608;
|
|
49213
49220
|
if (!strictNullChecks && flags & 98304) {
|
|
@@ -49400,7 +49407,7 @@ var ts;
|
|
|
49400
49407
|
origin = createOriginUnionOrIntersectionType(1048576, reducedTypes);
|
|
49401
49408
|
}
|
|
49402
49409
|
}
|
|
49403
|
-
var objectFlags = (includes &
|
|
49410
|
+
var objectFlags = (includes & 36323363 ? 0 : 65536) |
|
|
49404
49411
|
(includes & 2097152 ? 33554432 : 0);
|
|
49405
49412
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
49406
49413
|
}
|
|
@@ -52260,7 +52267,7 @@ var ts;
|
|
|
52260
52267
|
return true;
|
|
52261
52268
|
}
|
|
52262
52269
|
if (source.flags & 524288 && target.flags & 524288) {
|
|
52263
|
-
var related = relation.get(getRelationKey(source, target, 0, relation));
|
|
52270
|
+
var related = relation.get(getRelationKey(source, target, 0, relation, false));
|
|
52264
52271
|
if (related !== undefined) {
|
|
52265
52272
|
return !!(related & 1);
|
|
52266
52273
|
}
|
|
@@ -52974,7 +52981,8 @@ var ts;
|
|
|
52974
52981
|
if (overflow) {
|
|
52975
52982
|
return 0;
|
|
52976
52983
|
}
|
|
52977
|
-
var
|
|
52984
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 : 0);
|
|
52985
|
+
var id = getRelationKey(source, target, keyIntersectionState, relation, false);
|
|
52978
52986
|
var entry = relation.get(id);
|
|
52979
52987
|
if (entry !== undefined) {
|
|
52980
52988
|
if (reportErrors && entry & 2 && !(entry & 4)) {
|
|
@@ -52998,12 +53006,9 @@ var ts;
|
|
|
52998
53006
|
targetStack = [];
|
|
52999
53007
|
}
|
|
53000
53008
|
else {
|
|
53001
|
-
var broadestEquivalentId = id.
|
|
53002
|
-
var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
|
|
53003
|
-
return "=" + index;
|
|
53004
|
-
}); }).join(",");
|
|
53009
|
+
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, true) : undefined;
|
|
53005
53010
|
for (var i = 0; i < maybeCount; i++) {
|
|
53006
|
-
if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
|
|
53011
|
+
if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
|
|
53007
53012
|
return 3;
|
|
53008
53013
|
}
|
|
53009
53014
|
}
|
|
@@ -53245,7 +53250,7 @@ var ts;
|
|
|
53245
53250
|
originalErrorInfo = undefined;
|
|
53246
53251
|
}
|
|
53247
53252
|
}
|
|
53248
|
-
else if (isGenericMappedType(target)) {
|
|
53253
|
+
else if (isGenericMappedType(target) && relation !== identityRelation) {
|
|
53249
53254
|
var keysRemapped = !!target.declaration.nameType;
|
|
53250
53255
|
var templateType = getTemplateTypeFromMappedType(target);
|
|
53251
53256
|
var modifiers = getMappedTypeModifiers(target);
|
|
@@ -54277,40 +54282,48 @@ var ts;
|
|
|
54277
54282
|
function isTypeReferenceWithGenericArguments(type) {
|
|
54278
54283
|
return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144) || isTypeReferenceWithGenericArguments(t); });
|
|
54279
54284
|
}
|
|
54280
|
-
function
|
|
54281
|
-
|
|
54282
|
-
var
|
|
54283
|
-
|
|
54284
|
-
|
|
54285
|
-
|
|
54286
|
-
|
|
54287
|
-
|
|
54288
|
-
|
|
54289
|
-
|
|
54285
|
+
function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) {
|
|
54286
|
+
var typeParameters = [];
|
|
54287
|
+
var constraintMarker = "";
|
|
54288
|
+
var sourceId = getTypeReferenceId(source, 0);
|
|
54289
|
+
var targetId = getTypeReferenceId(target, 0);
|
|
54290
|
+
return "" + constraintMarker + sourceId + "," + targetId + postFix;
|
|
54291
|
+
function getTypeReferenceId(type, depth) {
|
|
54292
|
+
if (depth === void 0) { depth = 0; }
|
|
54293
|
+
var result = "" + type.target.id;
|
|
54294
|
+
for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
|
|
54295
|
+
var t = _a[_i];
|
|
54296
|
+
if (t.flags & 262144) {
|
|
54297
|
+
if (ignoreConstraints || isUnconstrainedTypeParameter(t)) {
|
|
54298
|
+
var index = typeParameters.indexOf(t);
|
|
54299
|
+
if (index < 0) {
|
|
54300
|
+
index = typeParameters.length;
|
|
54301
|
+
typeParameters.push(t);
|
|
54302
|
+
}
|
|
54303
|
+
result += "=" + index;
|
|
54304
|
+
continue;
|
|
54305
|
+
}
|
|
54306
|
+
constraintMarker = "*";
|
|
54307
|
+
}
|
|
54308
|
+
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
54309
|
+
result += "<" + getTypeReferenceId(t, depth + 1) + ">";
|
|
54310
|
+
continue;
|
|
54290
54311
|
}
|
|
54291
|
-
result += "=" + index;
|
|
54292
|
-
}
|
|
54293
|
-
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
54294
|
-
result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
|
|
54295
|
-
}
|
|
54296
|
-
else {
|
|
54297
54312
|
result += "-" + t.id;
|
|
54298
54313
|
}
|
|
54314
|
+
return result;
|
|
54299
54315
|
}
|
|
54300
|
-
return result;
|
|
54301
54316
|
}
|
|
54302
|
-
function getRelationKey(source, target, intersectionState, relation) {
|
|
54317
|
+
function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) {
|
|
54303
54318
|
if (relation === identityRelation && source.id > target.id) {
|
|
54304
54319
|
var temp = source;
|
|
54305
54320
|
source = target;
|
|
54306
54321
|
target = temp;
|
|
54307
54322
|
}
|
|
54308
54323
|
var postFix = intersectionState ? ":" + intersectionState : "";
|
|
54309
|
-
|
|
54310
|
-
|
|
54311
|
-
|
|
54312
|
-
}
|
|
54313
|
-
return source.id + "," + target.id + postFix;
|
|
54324
|
+
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ?
|
|
54325
|
+
getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) :
|
|
54326
|
+
source.id + "," + target.id + postFix;
|
|
54314
54327
|
}
|
|
54315
54328
|
function forEachProperty(prop, callback) {
|
|
54316
54329
|
if (ts.getCheckFlags(prop) & 6) {
|
|
@@ -54349,16 +54362,21 @@ var ts;
|
|
|
54349
54362
|
!hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
|
|
54350
54363
|
}
|
|
54351
54364
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
54352
|
-
if (maxDepth === void 0) { maxDepth =
|
|
54365
|
+
if (maxDepth === void 0) { maxDepth = 3; }
|
|
54353
54366
|
if (depth >= maxDepth) {
|
|
54354
54367
|
var identity_1 = getRecursionIdentity(type);
|
|
54355
54368
|
var count = 0;
|
|
54369
|
+
var lastTypeId = 0;
|
|
54356
54370
|
for (var i = 0; i < depth; i++) {
|
|
54357
|
-
|
|
54358
|
-
|
|
54359
|
-
if (
|
|
54360
|
-
|
|
54371
|
+
var t = stack[i];
|
|
54372
|
+
if (getRecursionIdentity(t) === identity_1) {
|
|
54373
|
+
if (t.id >= lastTypeId) {
|
|
54374
|
+
count++;
|
|
54375
|
+
if (count >= maxDepth) {
|
|
54376
|
+
return true;
|
|
54377
|
+
}
|
|
54361
54378
|
}
|
|
54379
|
+
lastTypeId = t.id;
|
|
54362
54380
|
}
|
|
54363
54381
|
}
|
|
54364
54382
|
}
|
|
@@ -56182,27 +56200,6 @@ var ts;
|
|
|
56182
56200
|
}
|
|
56183
56201
|
return false;
|
|
56184
56202
|
}
|
|
56185
|
-
function getPropertyAccess(expr) {
|
|
56186
|
-
if (ts.isAccessExpression(expr)) {
|
|
56187
|
-
return expr;
|
|
56188
|
-
}
|
|
56189
|
-
if (ts.isIdentifier(expr)) {
|
|
56190
|
-
var symbol = getResolvedSymbol(expr);
|
|
56191
|
-
if (isConstVariable(symbol)) {
|
|
56192
|
-
var declaration = symbol.valueDeclaration;
|
|
56193
|
-
if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer)) {
|
|
56194
|
-
return declaration.initializer;
|
|
56195
|
-
}
|
|
56196
|
-
if (ts.isBindingElement(declaration) && !declaration.initializer) {
|
|
56197
|
-
var parent = declaration.parent.parent;
|
|
56198
|
-
if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer))) {
|
|
56199
|
-
return declaration;
|
|
56200
|
-
}
|
|
56201
|
-
}
|
|
56202
|
-
}
|
|
56203
|
-
}
|
|
56204
|
-
return undefined;
|
|
56205
|
-
}
|
|
56206
56203
|
function getAccessedPropertyName(access) {
|
|
56207
56204
|
var propertyName;
|
|
56208
56205
|
return access.kind === 205 ? access.name.escapedText :
|
|
@@ -57037,20 +57034,21 @@ var ts;
|
|
|
57037
57034
|
}
|
|
57038
57035
|
return false;
|
|
57039
57036
|
}
|
|
57040
|
-
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) {
|
|
57037
|
+
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, flowNode) {
|
|
57041
57038
|
if (initialType === void 0) { initialType = declaredType; }
|
|
57039
|
+
if (flowNode === void 0) { flowNode = reference.flowNode; }
|
|
57042
57040
|
var key;
|
|
57043
57041
|
var isKeySet = false;
|
|
57044
57042
|
var flowDepth = 0;
|
|
57045
57043
|
if (flowAnalysisDisabled) {
|
|
57046
57044
|
return errorType;
|
|
57047
57045
|
}
|
|
57048
|
-
if (!
|
|
57046
|
+
if (!flowNode) {
|
|
57049
57047
|
return declaredType;
|
|
57050
57048
|
}
|
|
57051
57049
|
flowInvocationCount++;
|
|
57052
57050
|
var sharedFlowStart = sharedFlowCount;
|
|
57053
|
-
var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(
|
|
57051
|
+
var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
|
|
57054
57052
|
sharedFlowCount = sharedFlowStart;
|
|
57055
57053
|
var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
|
|
57056
57054
|
if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 229 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) {
|
|
@@ -57407,13 +57405,52 @@ var ts;
|
|
|
57407
57405
|
}
|
|
57408
57406
|
return result;
|
|
57409
57407
|
}
|
|
57408
|
+
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
57409
|
+
if (ts.isBindingPattern(reference)) {
|
|
57410
|
+
if (ts.isIdentifier(expr)) {
|
|
57411
|
+
var symbol = getResolvedSymbol(expr);
|
|
57412
|
+
var declaration = symbol.valueDeclaration;
|
|
57413
|
+
if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && reference === declaration.parent) {
|
|
57414
|
+
return declaration;
|
|
57415
|
+
}
|
|
57416
|
+
}
|
|
57417
|
+
}
|
|
57418
|
+
else if (ts.isAccessExpression(expr)) {
|
|
57419
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
57420
|
+
return expr;
|
|
57421
|
+
}
|
|
57422
|
+
}
|
|
57423
|
+
else if (ts.isIdentifier(expr)) {
|
|
57424
|
+
var symbol = getResolvedSymbol(expr);
|
|
57425
|
+
if (isConstVariable(symbol)) {
|
|
57426
|
+
var declaration = symbol.valueDeclaration;
|
|
57427
|
+
if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer) &&
|
|
57428
|
+
isMatchingReference(reference, declaration.initializer.expression)) {
|
|
57429
|
+
return declaration.initializer;
|
|
57430
|
+
}
|
|
57431
|
+
if (ts.isBindingElement(declaration) && !declaration.initializer) {
|
|
57432
|
+
var parent = declaration.parent.parent;
|
|
57433
|
+
if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer)) &&
|
|
57434
|
+
isMatchingReference(reference, parent.initializer)) {
|
|
57435
|
+
return declaration;
|
|
57436
|
+
}
|
|
57437
|
+
}
|
|
57438
|
+
}
|
|
57439
|
+
}
|
|
57440
|
+
return undefined;
|
|
57441
|
+
}
|
|
57410
57442
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
57411
|
-
var access, name;
|
|
57412
57443
|
var type = declaredType.flags & 1048576 ? declaredType : computedType;
|
|
57413
|
-
|
|
57414
|
-
|
|
57415
|
-
|
|
57416
|
-
|
|
57444
|
+
if (type.flags & 1048576) {
|
|
57445
|
+
var access = getCandidateDiscriminantPropertyAccess(expr);
|
|
57446
|
+
if (access) {
|
|
57447
|
+
var name = getAccessedPropertyName(access);
|
|
57448
|
+
if (name && isDiscriminantProperty(type, name)) {
|
|
57449
|
+
return access;
|
|
57450
|
+
}
|
|
57451
|
+
}
|
|
57452
|
+
}
|
|
57453
|
+
return undefined;
|
|
57417
57454
|
}
|
|
57418
57455
|
function narrowTypeByDiscriminant(type, access, narrowType) {
|
|
57419
57456
|
var propName = getAccessedPropertyName(access);
|
|
@@ -58056,6 +58093,26 @@ var ts;
|
|
|
58056
58093
|
}
|
|
58057
58094
|
}
|
|
58058
58095
|
}
|
|
58096
|
+
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
58097
|
+
var declaration = symbol.valueDeclaration;
|
|
58098
|
+
if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
58099
|
+
var parent = declaration.parent.parent;
|
|
58100
|
+
if (parent.kind === 253 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 163) {
|
|
58101
|
+
var links = getNodeLinks(location);
|
|
58102
|
+
if (!(links.flags & 268435456)) {
|
|
58103
|
+
links.flags |= 268435456;
|
|
58104
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
58105
|
+
links.flags &= ~268435456;
|
|
58106
|
+
if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
|
|
58107
|
+
var pattern = declaration.parent;
|
|
58108
|
+
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode);
|
|
58109
|
+
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
58110
|
+
}
|
|
58111
|
+
}
|
|
58112
|
+
}
|
|
58113
|
+
}
|
|
58114
|
+
return getTypeOfSymbol(symbol);
|
|
58115
|
+
}
|
|
58059
58116
|
function checkIdentifier(node, checkMode) {
|
|
58060
58117
|
var symbol = getResolvedSymbol(node);
|
|
58061
58118
|
if (symbol === unknownSymbol) {
|
|
@@ -58115,7 +58172,7 @@ var ts;
|
|
|
58115
58172
|
}
|
|
58116
58173
|
}
|
|
58117
58174
|
checkNestedBlockScopedBinding(node, symbol);
|
|
58118
|
-
var type =
|
|
58175
|
+
var type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
58119
58176
|
var assignmentKind = ts.getAssignmentTargetKind(node);
|
|
58120
58177
|
if (assignmentKind) {
|
|
58121
58178
|
if (!(localOrExportSymbol.flags & 3) &&
|
|
@@ -58977,13 +59034,13 @@ var ts;
|
|
|
58977
59034
|
function isCircularMappedProperty(symbol) {
|
|
58978
59035
|
return !!(ts.getCheckFlags(symbol) & 262144 && !symbol.type && findResolutionCycleStartIndex(symbol, 0) >= 0);
|
|
58979
59036
|
}
|
|
58980
|
-
function getTypeOfPropertyOfContextualType(type, name) {
|
|
59037
|
+
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
58981
59038
|
return mapType(type, function (t) {
|
|
58982
59039
|
var _a;
|
|
58983
59040
|
if (isGenericMappedType(t)) {
|
|
58984
59041
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
58985
59042
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
58986
|
-
var propertyNameType = getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
59043
|
+
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
58987
59044
|
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
58988
59045
|
return substituteIndexedMappedType(t, propertyNameType);
|
|
58989
59046
|
}
|
|
@@ -58999,7 +59056,7 @@ var ts;
|
|
|
58999
59056
|
return restType;
|
|
59000
59057
|
}
|
|
59001
59058
|
}
|
|
59002
|
-
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
59059
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
59003
59060
|
}
|
|
59004
59061
|
return undefined;
|
|
59005
59062
|
}, true);
|
|
@@ -59020,7 +59077,8 @@ var ts;
|
|
|
59020
59077
|
var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
|
|
59021
59078
|
if (type) {
|
|
59022
59079
|
if (hasBindableName(element)) {
|
|
59023
|
-
|
|
59080
|
+
var symbol = getSymbolOfNode(element);
|
|
59081
|
+
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
59024
59082
|
}
|
|
59025
59083
|
if (element.name) {
|
|
59026
59084
|
var nameType_2 = getLiteralTypeFromPropertyName(element.name);
|
|
@@ -65693,6 +65751,8 @@ var ts;
|
|
|
65693
65751
|
if (!typeReferenceNode)
|
|
65694
65752
|
return undefined;
|
|
65695
65753
|
var typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
|
|
65754
|
+
if (!typeParameters)
|
|
65755
|
+
return undefined;
|
|
65696
65756
|
var constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
|
|
65697
65757
|
return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
|
|
65698
65758
|
}
|
|
@@ -69343,8 +69403,11 @@ var ts;
|
|
|
69343
69403
|
function checkAssertClause(declaration) {
|
|
69344
69404
|
var _a;
|
|
69345
69405
|
if (declaration.assertClause) {
|
|
69346
|
-
|
|
69347
|
-
|
|
69406
|
+
var mode = (moduleKind === ts.ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
69407
|
+
if (mode !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.ESNext) {
|
|
69408
|
+
return grammarErrorOnNode(declaration.assertClause, moduleKind === ts.ModuleKind.NodeNext
|
|
69409
|
+
? ts.Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls
|
|
69410
|
+
: ts.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext);
|
|
69348
69411
|
}
|
|
69349
69412
|
if (ts.isImportDeclaration(declaration) ? (_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
69350
69413
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
@@ -72847,11 +72910,11 @@ var ts;
|
|
|
72847
72910
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
72848
72911
|
}
|
|
72849
72912
|
var nodeArguments = node.arguments;
|
|
72850
|
-
if (moduleKind !== ts.ModuleKind.ESNext) {
|
|
72913
|
+
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
|
|
72851
72914
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
72852
72915
|
if (nodeArguments.length > 1) {
|
|
72853
72916
|
var assertionArgument = nodeArguments[1];
|
|
72854
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
72917
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
|
|
72855
72918
|
}
|
|
72856
72919
|
}
|
|
72857
72920
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|