typescript 4.9.0-dev.20220914 → 4.9.0-dev.20220916
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/cs/diagnosticMessages.generated.json +3 -0
- package/lib/de/diagnosticMessages.generated.json +3 -0
- package/lib/es/diagnosticMessages.generated.json +3 -0
- package/lib/fr/diagnosticMessages.generated.json +3 -0
- package/lib/it/diagnosticMessages.generated.json +3 -0
- package/lib/ja/diagnosticMessages.generated.json +3 -0
- package/lib/ko/diagnosticMessages.generated.json +3 -0
- package/lib/pl/diagnosticMessages.generated.json +3 -0
- package/lib/pt-br/diagnosticMessages.generated.json +3 -0
- package/lib/ru/diagnosticMessages.generated.json +3 -0
- package/lib/tr/diagnosticMessages.generated.json +3 -0
- package/lib/tsc.js +67 -35
- package/lib/tsserver.js +68 -38
- package/lib/tsserverlibrary.js +68 -38
- package/lib/typescript.js +68 -38
- package/lib/typescriptServices.js +68 -38
- package/lib/typingsInstaller.js +68 -38
- package/lib/zh-cn/diagnosticMessages.generated.json +3 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +3 -0
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220916");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -10111,6 +10111,11 @@ var ts;
|
|
|
10111
10111
|
Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."),
|
|
10112
10112
|
_0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."),
|
|
10113
10113
|
Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."),
|
|
10114
|
+
_0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."),
|
|
10115
|
+
_0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."),
|
|
10116
|
+
_0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."),
|
|
10117
|
+
_0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
10118
|
+
The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
10114
10119
|
};
|
|
10115
10120
|
})(ts || (ts = {}));
|
|
10116
10121
|
var ts;
|
|
@@ -54445,22 +54450,15 @@ var ts;
|
|
|
54445
54450
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54446
54451
|
return parameterNode;
|
|
54447
54452
|
function cloneBindingName(node) {
|
|
54448
|
-
return
|
|
54449
|
-
function
|
|
54453
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54454
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54450
54455
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54451
54456
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54452
54457
|
}
|
|
54453
|
-
var visited = ts.visitEachChild(node,
|
|
54458
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54454
54459
|
if (ts.isBindingElement(visited)) {
|
|
54455
|
-
|
|
54456
|
-
|
|
54457
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54458
|
-
/*initializer*/ undefined);
|
|
54459
|
-
}
|
|
54460
|
-
else {
|
|
54461
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54462
|
-
/*initializer*/ undefined);
|
|
54463
|
-
}
|
|
54460
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54461
|
+
/*initializer*/ undefined);
|
|
54464
54462
|
}
|
|
54465
54463
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54466
54464
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -66470,11 +66468,15 @@ var ts;
|
|
|
66470
66468
|
// parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't
|
|
66471
66469
|
// appear to be comparable to '2'.
|
|
66472
66470
|
if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) {
|
|
66473
|
-
var constraints = ts.sameMap(source.types,
|
|
66471
|
+
var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; });
|
|
66474
66472
|
if (constraints !== source.types) {
|
|
66475
66473
|
source = getIntersectionType(constraints);
|
|
66474
|
+
if (source.flags & 131072 /* TypeFlags.Never */) {
|
|
66475
|
+
return 0 /* Ternary.False */;
|
|
66476
|
+
}
|
|
66476
66477
|
if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) {
|
|
66477
|
-
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)
|
|
66478
|
+
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) ||
|
|
66479
|
+
isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false);
|
|
66478
66480
|
}
|
|
66479
66481
|
}
|
|
66480
66482
|
}
|
|
@@ -66792,7 +66794,7 @@ var ts;
|
|
|
66792
66794
|
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66793
66795
|
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66794
66796
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
|
|
66795
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66797
|
+
if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66796
66798
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66797
66799
|
result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66798
66800
|
}
|
|
@@ -72306,24 +72308,11 @@ var ts;
|
|
|
72306
72308
|
assumeTrue = !assumeTrue;
|
|
72307
72309
|
}
|
|
72308
72310
|
var valueType = getTypeOfExpression(value);
|
|
72309
|
-
|
|
72310
|
-
assumeTrue &&
|
|
72311
|
-
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
72312
|
-
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
72313
|
-
return valueType;
|
|
72314
|
-
}
|
|
72315
|
-
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72316
|
-
return nonPrimitiveType;
|
|
72317
|
-
}
|
|
72318
|
-
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72319
|
-
return type;
|
|
72320
|
-
}
|
|
72321
|
-
}
|
|
72311
|
+
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72322
72312
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
72323
72313
|
if (!strictNullChecks) {
|
|
72324
72314
|
return type;
|
|
72325
72315
|
}
|
|
72326
|
-
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72327
72316
|
var facts = doubleEquals ?
|
|
72328
72317
|
assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ :
|
|
72329
72318
|
valueType.flags & 65536 /* TypeFlags.Null */ ?
|
|
@@ -72332,10 +72321,16 @@ var ts;
|
|
|
72332
72321
|
return getAdjustedTypeWithFacts(type, facts);
|
|
72333
72322
|
}
|
|
72334
72323
|
if (assumeTrue) {
|
|
72335
|
-
|
|
72336
|
-
|
|
72337
|
-
|
|
72338
|
-
|
|
72324
|
+
if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
72325
|
+
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
72326
|
+
return valueType;
|
|
72327
|
+
}
|
|
72328
|
+
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72329
|
+
return nonPrimitiveType;
|
|
72330
|
+
}
|
|
72331
|
+
}
|
|
72332
|
+
var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); });
|
|
72333
|
+
return replacePrimitivesWithLiterals(filteredType, valueType);
|
|
72339
72334
|
}
|
|
72340
72335
|
if (isUnitType(valueType)) {
|
|
72341
72336
|
return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); });
|
|
@@ -75824,10 +75819,27 @@ var ts;
|
|
|
75824
75819
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
75825
75820
|
}
|
|
75826
75821
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
75827
|
-
|
|
75828
|
-
|
|
75829
|
-
ts.Diagnostics.
|
|
75830
|
-
|
|
75822
|
+
var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined;
|
|
75823
|
+
if (node.kind === 104 /* SyntaxKind.NullKeyword */) {
|
|
75824
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
75825
|
+
return;
|
|
75826
|
+
}
|
|
75827
|
+
if (nodeText !== undefined && nodeText.length < 100) {
|
|
75828
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75829
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
75830
|
+
return;
|
|
75831
|
+
}
|
|
75832
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75833
|
+
ts.Diagnostics._0_is_possibly_null_or_undefined :
|
|
75834
|
+
ts.Diagnostics._0_is_possibly_undefined :
|
|
75835
|
+
ts.Diagnostics._0_is_possibly_null, nodeText);
|
|
75836
|
+
}
|
|
75837
|
+
else {
|
|
75838
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75839
|
+
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
75840
|
+
ts.Diagnostics.Object_is_possibly_undefined :
|
|
75841
|
+
ts.Diagnostics.Object_is_possibly_null);
|
|
75842
|
+
}
|
|
75831
75843
|
}
|
|
75832
75844
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
75833
75845
|
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
@@ -75837,6 +75849,13 @@ var ts;
|
|
|
75837
75849
|
}
|
|
75838
75850
|
function checkNonNullTypeWithReporter(type, node, reportError) {
|
|
75839
75851
|
if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) {
|
|
75852
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75853
|
+
var nodeText = ts.entityNameToString(node);
|
|
75854
|
+
if (nodeText.length < 100) {
|
|
75855
|
+
error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText);
|
|
75856
|
+
return errorType;
|
|
75857
|
+
}
|
|
75858
|
+
}
|
|
75840
75859
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
75841
75860
|
return errorType;
|
|
75842
75861
|
}
|
|
@@ -75854,6 +75873,17 @@ var ts;
|
|
|
75854
75873
|
function checkNonNullNonVoidType(type, node) {
|
|
75855
75874
|
var nonNullType = checkNonNullType(type, node);
|
|
75856
75875
|
if (nonNullType.flags & 16384 /* TypeFlags.Void */) {
|
|
75876
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75877
|
+
var nodeText = ts.entityNameToString(node);
|
|
75878
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75879
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText);
|
|
75880
|
+
return nonNullType;
|
|
75881
|
+
}
|
|
75882
|
+
if (nodeText.length < 100) {
|
|
75883
|
+
error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText);
|
|
75884
|
+
return nonNullType;
|
|
75885
|
+
}
|
|
75886
|
+
}
|
|
75857
75887
|
error(node, ts.Diagnostics.Object_is_possibly_undefined);
|
|
75858
75888
|
}
|
|
75859
75889
|
return nonNullType;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220916");
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -10110,6 +10110,11 @@ var ts;
|
|
|
10110
10110
|
Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."),
|
|
10111
10111
|
_0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."),
|
|
10112
10112
|
Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."),
|
|
10113
|
+
_0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."),
|
|
10114
|
+
_0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."),
|
|
10115
|
+
_0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."),
|
|
10116
|
+
_0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
10117
|
+
The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
10113
10118
|
};
|
|
10114
10119
|
})(ts || (ts = {}));
|
|
10115
10120
|
var ts;
|
|
@@ -54444,22 +54449,15 @@ var ts;
|
|
|
54444
54449
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54445
54450
|
return parameterNode;
|
|
54446
54451
|
function cloneBindingName(node) {
|
|
54447
|
-
return
|
|
54448
|
-
function
|
|
54452
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54453
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54449
54454
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54450
54455
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54451
54456
|
}
|
|
54452
|
-
var visited = ts.visitEachChild(node,
|
|
54457
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54453
54458
|
if (ts.isBindingElement(visited)) {
|
|
54454
|
-
|
|
54455
|
-
|
|
54456
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54457
|
-
/*initializer*/ undefined);
|
|
54458
|
-
}
|
|
54459
|
-
else {
|
|
54460
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54461
|
-
/*initializer*/ undefined);
|
|
54462
|
-
}
|
|
54459
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54460
|
+
/*initializer*/ undefined);
|
|
54463
54461
|
}
|
|
54464
54462
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54465
54463
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -66469,11 +66467,15 @@ var ts;
|
|
|
66469
66467
|
// parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't
|
|
66470
66468
|
// appear to be comparable to '2'.
|
|
66471
66469
|
if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) {
|
|
66472
|
-
var constraints = ts.sameMap(source.types,
|
|
66470
|
+
var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; });
|
|
66473
66471
|
if (constraints !== source.types) {
|
|
66474
66472
|
source = getIntersectionType(constraints);
|
|
66473
|
+
if (source.flags & 131072 /* TypeFlags.Never */) {
|
|
66474
|
+
return 0 /* Ternary.False */;
|
|
66475
|
+
}
|
|
66475
66476
|
if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) {
|
|
66476
|
-
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)
|
|
66477
|
+
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) ||
|
|
66478
|
+
isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false);
|
|
66477
66479
|
}
|
|
66478
66480
|
}
|
|
66479
66481
|
}
|
|
@@ -66791,7 +66793,7 @@ var ts;
|
|
|
66791
66793
|
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66792
66794
|
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66793
66795
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
|
|
66794
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66796
|
+
if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66795
66797
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66796
66798
|
result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66797
66799
|
}
|
|
@@ -72305,24 +72307,11 @@ var ts;
|
|
|
72305
72307
|
assumeTrue = !assumeTrue;
|
|
72306
72308
|
}
|
|
72307
72309
|
var valueType = getTypeOfExpression(value);
|
|
72308
|
-
|
|
72309
|
-
assumeTrue &&
|
|
72310
|
-
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
72311
|
-
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
72312
|
-
return valueType;
|
|
72313
|
-
}
|
|
72314
|
-
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72315
|
-
return nonPrimitiveType;
|
|
72316
|
-
}
|
|
72317
|
-
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72318
|
-
return type;
|
|
72319
|
-
}
|
|
72320
|
-
}
|
|
72310
|
+
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72321
72311
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
72322
72312
|
if (!strictNullChecks) {
|
|
72323
72313
|
return type;
|
|
72324
72314
|
}
|
|
72325
|
-
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72326
72315
|
var facts = doubleEquals ?
|
|
72327
72316
|
assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ :
|
|
72328
72317
|
valueType.flags & 65536 /* TypeFlags.Null */ ?
|
|
@@ -72331,10 +72320,16 @@ var ts;
|
|
|
72331
72320
|
return getAdjustedTypeWithFacts(type, facts);
|
|
72332
72321
|
}
|
|
72333
72322
|
if (assumeTrue) {
|
|
72334
|
-
|
|
72335
|
-
|
|
72336
|
-
|
|
72337
|
-
|
|
72323
|
+
if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
72324
|
+
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
72325
|
+
return valueType;
|
|
72326
|
+
}
|
|
72327
|
+
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72328
|
+
return nonPrimitiveType;
|
|
72329
|
+
}
|
|
72330
|
+
}
|
|
72331
|
+
var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); });
|
|
72332
|
+
return replacePrimitivesWithLiterals(filteredType, valueType);
|
|
72338
72333
|
}
|
|
72339
72334
|
if (isUnitType(valueType)) {
|
|
72340
72335
|
return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); });
|
|
@@ -75823,10 +75818,27 @@ var ts;
|
|
|
75823
75818
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
75824
75819
|
}
|
|
75825
75820
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
75826
|
-
|
|
75827
|
-
|
|
75828
|
-
ts.Diagnostics.
|
|
75829
|
-
|
|
75821
|
+
var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined;
|
|
75822
|
+
if (node.kind === 104 /* SyntaxKind.NullKeyword */) {
|
|
75823
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
75824
|
+
return;
|
|
75825
|
+
}
|
|
75826
|
+
if (nodeText !== undefined && nodeText.length < 100) {
|
|
75827
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75828
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
75829
|
+
return;
|
|
75830
|
+
}
|
|
75831
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75832
|
+
ts.Diagnostics._0_is_possibly_null_or_undefined :
|
|
75833
|
+
ts.Diagnostics._0_is_possibly_undefined :
|
|
75834
|
+
ts.Diagnostics._0_is_possibly_null, nodeText);
|
|
75835
|
+
}
|
|
75836
|
+
else {
|
|
75837
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75838
|
+
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
75839
|
+
ts.Diagnostics.Object_is_possibly_undefined :
|
|
75840
|
+
ts.Diagnostics.Object_is_possibly_null);
|
|
75841
|
+
}
|
|
75830
75842
|
}
|
|
75831
75843
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
75832
75844
|
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
@@ -75836,6 +75848,13 @@ var ts;
|
|
|
75836
75848
|
}
|
|
75837
75849
|
function checkNonNullTypeWithReporter(type, node, reportError) {
|
|
75838
75850
|
if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) {
|
|
75851
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75852
|
+
var nodeText = ts.entityNameToString(node);
|
|
75853
|
+
if (nodeText.length < 100) {
|
|
75854
|
+
error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText);
|
|
75855
|
+
return errorType;
|
|
75856
|
+
}
|
|
75857
|
+
}
|
|
75839
75858
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
75840
75859
|
return errorType;
|
|
75841
75860
|
}
|
|
@@ -75853,6 +75872,17 @@ var ts;
|
|
|
75853
75872
|
function checkNonNullNonVoidType(type, node) {
|
|
75854
75873
|
var nonNullType = checkNonNullType(type, node);
|
|
75855
75874
|
if (nonNullType.flags & 16384 /* TypeFlags.Void */) {
|
|
75875
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75876
|
+
var nodeText = ts.entityNameToString(node);
|
|
75877
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75878
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText);
|
|
75879
|
+
return nonNullType;
|
|
75880
|
+
}
|
|
75881
|
+
if (nodeText.length < 100) {
|
|
75882
|
+
error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText);
|
|
75883
|
+
return nonNullType;
|
|
75884
|
+
}
|
|
75885
|
+
}
|
|
75856
75886
|
error(node, ts.Diagnostics.Object_is_possibly_undefined);
|
|
75857
75887
|
}
|
|
75858
75888
|
return nonNullType;
|
package/lib/typescript.js
CHANGED
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220916");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -10101,6 +10101,11 @@ var ts;
|
|
|
10101
10101
|
Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."),
|
|
10102
10102
|
_0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."),
|
|
10103
10103
|
Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."),
|
|
10104
|
+
_0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."),
|
|
10105
|
+
_0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."),
|
|
10106
|
+
_0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."),
|
|
10107
|
+
_0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
10108
|
+
The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
10104
10109
|
};
|
|
10105
10110
|
})(ts || (ts = {}));
|
|
10106
10111
|
var ts;
|
|
@@ -54435,22 +54440,15 @@ var ts;
|
|
|
54435
54440
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54436
54441
|
return parameterNode;
|
|
54437
54442
|
function cloneBindingName(node) {
|
|
54438
|
-
return
|
|
54439
|
-
function
|
|
54443
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54444
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54440
54445
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54441
54446
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54442
54447
|
}
|
|
54443
|
-
var visited = ts.visitEachChild(node,
|
|
54448
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54444
54449
|
if (ts.isBindingElement(visited)) {
|
|
54445
|
-
|
|
54446
|
-
|
|
54447
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54448
|
-
/*initializer*/ undefined);
|
|
54449
|
-
}
|
|
54450
|
-
else {
|
|
54451
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54452
|
-
/*initializer*/ undefined);
|
|
54453
|
-
}
|
|
54450
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54451
|
+
/*initializer*/ undefined);
|
|
54454
54452
|
}
|
|
54455
54453
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54456
54454
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -66460,11 +66458,15 @@ var ts;
|
|
|
66460
66458
|
// parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't
|
|
66461
66459
|
// appear to be comparable to '2'.
|
|
66462
66460
|
if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) {
|
|
66463
|
-
var constraints = ts.sameMap(source.types,
|
|
66461
|
+
var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; });
|
|
66464
66462
|
if (constraints !== source.types) {
|
|
66465
66463
|
source = getIntersectionType(constraints);
|
|
66464
|
+
if (source.flags & 131072 /* TypeFlags.Never */) {
|
|
66465
|
+
return 0 /* Ternary.False */;
|
|
66466
|
+
}
|
|
66466
66467
|
if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) {
|
|
66467
|
-
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)
|
|
66468
|
+
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) ||
|
|
66469
|
+
isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false);
|
|
66468
66470
|
}
|
|
66469
66471
|
}
|
|
66470
66472
|
}
|
|
@@ -66782,7 +66784,7 @@ var ts;
|
|
|
66782
66784
|
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66783
66785
|
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66784
66786
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
|
|
66785
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66787
|
+
if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66786
66788
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66787
66789
|
result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66788
66790
|
}
|
|
@@ -72296,24 +72298,11 @@ var ts;
|
|
|
72296
72298
|
assumeTrue = !assumeTrue;
|
|
72297
72299
|
}
|
|
72298
72300
|
var valueType = getTypeOfExpression(value);
|
|
72299
|
-
|
|
72300
|
-
assumeTrue &&
|
|
72301
|
-
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
72302
|
-
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
72303
|
-
return valueType;
|
|
72304
|
-
}
|
|
72305
|
-
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72306
|
-
return nonPrimitiveType;
|
|
72307
|
-
}
|
|
72308
|
-
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72309
|
-
return type;
|
|
72310
|
-
}
|
|
72311
|
-
}
|
|
72301
|
+
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72312
72302
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
72313
72303
|
if (!strictNullChecks) {
|
|
72314
72304
|
return type;
|
|
72315
72305
|
}
|
|
72316
|
-
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72317
72306
|
var facts = doubleEquals ?
|
|
72318
72307
|
assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ :
|
|
72319
72308
|
valueType.flags & 65536 /* TypeFlags.Null */ ?
|
|
@@ -72322,10 +72311,16 @@ var ts;
|
|
|
72322
72311
|
return getAdjustedTypeWithFacts(type, facts);
|
|
72323
72312
|
}
|
|
72324
72313
|
if (assumeTrue) {
|
|
72325
|
-
|
|
72326
|
-
|
|
72327
|
-
|
|
72328
|
-
|
|
72314
|
+
if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
72315
|
+
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
72316
|
+
return valueType;
|
|
72317
|
+
}
|
|
72318
|
+
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72319
|
+
return nonPrimitiveType;
|
|
72320
|
+
}
|
|
72321
|
+
}
|
|
72322
|
+
var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); });
|
|
72323
|
+
return replacePrimitivesWithLiterals(filteredType, valueType);
|
|
72329
72324
|
}
|
|
72330
72325
|
if (isUnitType(valueType)) {
|
|
72331
72326
|
return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); });
|
|
@@ -75814,10 +75809,27 @@ var ts;
|
|
|
75814
75809
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
75815
75810
|
}
|
|
75816
75811
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
75817
|
-
|
|
75818
|
-
|
|
75819
|
-
ts.Diagnostics.
|
|
75820
|
-
|
|
75812
|
+
var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined;
|
|
75813
|
+
if (node.kind === 104 /* SyntaxKind.NullKeyword */) {
|
|
75814
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
75815
|
+
return;
|
|
75816
|
+
}
|
|
75817
|
+
if (nodeText !== undefined && nodeText.length < 100) {
|
|
75818
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75819
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
75820
|
+
return;
|
|
75821
|
+
}
|
|
75822
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75823
|
+
ts.Diagnostics._0_is_possibly_null_or_undefined :
|
|
75824
|
+
ts.Diagnostics._0_is_possibly_undefined :
|
|
75825
|
+
ts.Diagnostics._0_is_possibly_null, nodeText);
|
|
75826
|
+
}
|
|
75827
|
+
else {
|
|
75828
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75829
|
+
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
75830
|
+
ts.Diagnostics.Object_is_possibly_undefined :
|
|
75831
|
+
ts.Diagnostics.Object_is_possibly_null);
|
|
75832
|
+
}
|
|
75821
75833
|
}
|
|
75822
75834
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
75823
75835
|
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
@@ -75827,6 +75839,13 @@ var ts;
|
|
|
75827
75839
|
}
|
|
75828
75840
|
function checkNonNullTypeWithReporter(type, node, reportError) {
|
|
75829
75841
|
if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) {
|
|
75842
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75843
|
+
var nodeText = ts.entityNameToString(node);
|
|
75844
|
+
if (nodeText.length < 100) {
|
|
75845
|
+
error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText);
|
|
75846
|
+
return errorType;
|
|
75847
|
+
}
|
|
75848
|
+
}
|
|
75830
75849
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
75831
75850
|
return errorType;
|
|
75832
75851
|
}
|
|
@@ -75844,6 +75863,17 @@ var ts;
|
|
|
75844
75863
|
function checkNonNullNonVoidType(type, node) {
|
|
75845
75864
|
var nonNullType = checkNonNullType(type, node);
|
|
75846
75865
|
if (nonNullType.flags & 16384 /* TypeFlags.Void */) {
|
|
75866
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75867
|
+
var nodeText = ts.entityNameToString(node);
|
|
75868
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75869
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText);
|
|
75870
|
+
return nonNullType;
|
|
75871
|
+
}
|
|
75872
|
+
if (nodeText.length < 100) {
|
|
75873
|
+
error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText);
|
|
75874
|
+
return nonNullType;
|
|
75875
|
+
}
|
|
75876
|
+
}
|
|
75847
75877
|
error(node, ts.Diagnostics.Object_is_possibly_undefined);
|
|
75848
75878
|
}
|
|
75849
75879
|
return nonNullType;
|