typescript 4.8.0-dev.20220707 → 4.8.0-dev.20220708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +46 -25
- package/lib/tsserver.js +236 -183
- package/lib/tsserverlibrary.js +236 -183
- package/lib/typescript.js +236 -183
- package/lib/typescriptServices.js +236 -183
- package/lib/typingsInstaller.js +57 -28
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220708";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1707,7 +1707,7 @@ var ts;
|
|
|
1707
1707
|
}
|
|
1708
1708
|
ts.compareBooleans = compareBooleans;
|
|
1709
1709
|
function getSpellingSuggestion(name, candidates, getName) {
|
|
1710
|
-
var maximumLengthDifference = Math.
|
|
1710
|
+
var maximumLengthDifference = Math.max(2, Math.floor(name.length * 0.34));
|
|
1711
1711
|
var bestDistance = Math.floor(name.length * 0.4) + 1;
|
|
1712
1712
|
var bestCandidate;
|
|
1713
1713
|
for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {
|
|
@@ -6203,6 +6203,7 @@ var ts;
|
|
|
6203
6203
|
The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6204
6204
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
6205
6205
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
6206
|
+
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
6206
6207
|
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}'."),
|
|
6207
6208
|
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}'."),
|
|
6208
6209
|
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}'."),
|
|
@@ -36372,6 +36373,7 @@ var ts;
|
|
|
36372
36373
|
return 1;
|
|
36373
36374
|
return 0;
|
|
36374
36375
|
}
|
|
36376
|
+
ts.comparePatternKeys = comparePatternKeys;
|
|
36375
36377
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
36376
36378
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
36377
36379
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
@@ -41245,6 +41247,7 @@ var ts;
|
|
|
41245
41247
|
var ctor = findConstructorDeclaration(location.parent);
|
|
41246
41248
|
if (ctor && ctor.locals) {
|
|
41247
41249
|
if (lookup(ctor.locals, name, meaning & 111551)) {
|
|
41250
|
+
ts.Debug.assertNode(location, ts.isPropertyDeclaration);
|
|
41248
41251
|
propertyWithInvalidInitializer = location;
|
|
41249
41252
|
}
|
|
41250
41253
|
}
|
|
@@ -41390,11 +41393,21 @@ var ts;
|
|
|
41390
41393
|
}
|
|
41391
41394
|
}
|
|
41392
41395
|
}
|
|
41396
|
+
function checkAndReportErrorForInvalidInitializer() {
|
|
41397
|
+
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
|
|
41398
|
+
error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos)
|
|
41399
|
+
? ts.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor
|
|
41400
|
+
: ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg));
|
|
41401
|
+
return true;
|
|
41402
|
+
}
|
|
41403
|
+
return false;
|
|
41404
|
+
}
|
|
41393
41405
|
if (!result) {
|
|
41394
41406
|
if (nameNotFoundMessage) {
|
|
41395
41407
|
addLazyDiagnostic(function () {
|
|
41396
41408
|
if (!errorLocation ||
|
|
41397
41409
|
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
|
|
41410
|
+
!checkAndReportErrorForInvalidInitializer() &&
|
|
41398
41411
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
41399
41412
|
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
|
|
41400
41413
|
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
|
|
@@ -41402,7 +41415,14 @@ var ts;
|
|
|
41402
41415
|
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
41403
41416
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
41404
41417
|
var suggestion = void 0;
|
|
41405
|
-
|
|
41418
|
+
var suggestedLib = void 0;
|
|
41419
|
+
if (nameArg) {
|
|
41420
|
+
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
41421
|
+
if (suggestedLib) {
|
|
41422
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
41423
|
+
}
|
|
41424
|
+
}
|
|
41425
|
+
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
41406
41426
|
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
41407
41427
|
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
41408
41428
|
if (isGlobalScopeAugmentationDeclaration) {
|
|
@@ -41421,16 +41441,8 @@ var ts;
|
|
|
41421
41441
|
}
|
|
41422
41442
|
}
|
|
41423
41443
|
}
|
|
41424
|
-
if (!suggestion) {
|
|
41425
|
-
|
|
41426
|
-
var lib = getSuggestedLibForNonExistentName(nameArg);
|
|
41427
|
-
if (lib) {
|
|
41428
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
|
|
41429
|
-
}
|
|
41430
|
-
else {
|
|
41431
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
41432
|
-
}
|
|
41433
|
-
}
|
|
41444
|
+
if (!suggestion && !suggestedLib && nameArg) {
|
|
41445
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
41434
41446
|
}
|
|
41435
41447
|
suggestionCount++;
|
|
41436
41448
|
}
|
|
@@ -41438,9 +41450,7 @@ var ts;
|
|
|
41438
41450
|
}
|
|
41439
41451
|
return undefined;
|
|
41440
41452
|
}
|
|
41441
|
-
if (
|
|
41442
|
-
var propertyName = propertyWithInvalidInitializer.name;
|
|
41443
|
-
error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
|
|
41453
|
+
else if (checkAndReportErrorForInvalidInitializer()) {
|
|
41444
41454
|
return undefined;
|
|
41445
41455
|
}
|
|
41446
41456
|
if (nameNotFoundMessage) {
|
|
@@ -51811,19 +51821,22 @@ var ts;
|
|
|
51811
51821
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
|
|
51812
51822
|
}
|
|
51813
51823
|
function isPossiblyReducibleByInstantiation(type) {
|
|
51814
|
-
|
|
51815
|
-
|
|
51816
|
-
|
|
51817
|
-
|
|
51824
|
+
var uniqueFilled = getUniqueLiteralFilledInstantiation(type);
|
|
51825
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
51826
|
+
}
|
|
51827
|
+
function shouldDeferIndexType(type) {
|
|
51828
|
+
return !!(type.flags & 58982400 ||
|
|
51829
|
+
isGenericTupleType(type) ||
|
|
51830
|
+
isGenericMappedType(type) && !hasDistributiveNameType(type) ||
|
|
51831
|
+
type.flags & 1048576 && ts.some(type.types, isPossiblyReducibleByInstantiation) ||
|
|
51832
|
+
type.flags & 2097152 && maybeTypeOfKind(type, 465829888) && ts.some(type.types, isEmptyAnonymousObjectType));
|
|
51818
51833
|
}
|
|
51819
51834
|
function getIndexType(type, stringsOnly, noIndexSignatures) {
|
|
51820
51835
|
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
|
|
51821
51836
|
type = getReducedType(type);
|
|
51822
|
-
return type
|
|
51823
|
-
?
|
|
51824
|
-
|
|
51825
|
-
type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
51826
|
-
type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
|
|
51837
|
+
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
|
|
51838
|
+
type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
51839
|
+
type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
51827
51840
|
ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
|
|
51828
51841
|
type === wildcardType ? wildcardType :
|
|
51829
51842
|
type.flags & 2 ? neverType :
|
|
@@ -58407,6 +58420,14 @@ var ts;
|
|
|
58407
58420
|
var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
|
|
58408
58421
|
return key && key + "." + propName;
|
|
58409
58422
|
}
|
|
58423
|
+
break;
|
|
58424
|
+
case 201:
|
|
58425
|
+
case 202:
|
|
58426
|
+
case 256:
|
|
58427
|
+
case 213:
|
|
58428
|
+
case 214:
|
|
58429
|
+
case 169:
|
|
58430
|
+
return getNodeId(node) + "#" + getTypeId(declaredType);
|
|
58410
58431
|
}
|
|
58411
58432
|
return undefined;
|
|
58412
58433
|
}
|