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
|
@@ -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;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
92
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220916");
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -10091,6 +10091,11 @@ var ts;
|
|
|
10091
10091
|
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."),
|
|
10092
10092
|
_0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."),
|
|
10093
10093
|
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."),
|
|
10094
|
+
_0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."),
|
|
10095
|
+
_0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."),
|
|
10096
|
+
_0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."),
|
|
10097
|
+
_0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
10098
|
+
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."),
|
|
10094
10099
|
};
|
|
10095
10100
|
})(ts || (ts = {}));
|
|
10096
10101
|
var ts;
|
|
@@ -54425,22 +54430,15 @@ var ts;
|
|
|
54425
54430
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
54426
54431
|
return parameterNode;
|
|
54427
54432
|
function cloneBindingName(node) {
|
|
54428
|
-
return
|
|
54429
|
-
function
|
|
54433
|
+
return elideInitializerAndSetEmitFlags(node);
|
|
54434
|
+
function elideInitializerAndSetEmitFlags(node) {
|
|
54430
54435
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
54431
54436
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
54432
54437
|
}
|
|
54433
|
-
var visited = ts.visitEachChild(node,
|
|
54438
|
+
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
|
|
54434
54439
|
if (ts.isBindingElement(visited)) {
|
|
54435
|
-
|
|
54436
|
-
|
|
54437
|
-
/* propertyName*/ undefined, visited.propertyName,
|
|
54438
|
-
/*initializer*/ undefined);
|
|
54439
|
-
}
|
|
54440
|
-
else {
|
|
54441
|
-
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54442
|
-
/*initializer*/ undefined);
|
|
54443
|
-
}
|
|
54440
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
54441
|
+
/*initializer*/ undefined);
|
|
54444
54442
|
}
|
|
54445
54443
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
54446
54444
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -66450,11 +66448,15 @@ var ts;
|
|
|
66450
66448
|
// parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't
|
|
66451
66449
|
// appear to be comparable to '2'.
|
|
66452
66450
|
if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) {
|
|
66453
|
-
var constraints = ts.sameMap(source.types,
|
|
66451
|
+
var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; });
|
|
66454
66452
|
if (constraints !== source.types) {
|
|
66455
66453
|
source = getIntersectionType(constraints);
|
|
66454
|
+
if (source.flags & 131072 /* TypeFlags.Never */) {
|
|
66455
|
+
return 0 /* Ternary.False */;
|
|
66456
|
+
}
|
|
66456
66457
|
if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) {
|
|
66457
|
-
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)
|
|
66458
|
+
return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) ||
|
|
66459
|
+
isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false);
|
|
66458
66460
|
}
|
|
66459
66461
|
}
|
|
66460
66462
|
}
|
|
@@ -66772,7 +66774,7 @@ var ts;
|
|
|
66772
66774
|
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66773
66775
|
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66774
66776
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
|
|
66775
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66777
|
+
if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66776
66778
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66777
66779
|
result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66778
66780
|
}
|
|
@@ -72286,24 +72288,11 @@ var ts;
|
|
|
72286
72288
|
assumeTrue = !assumeTrue;
|
|
72287
72289
|
}
|
|
72288
72290
|
var valueType = getTypeOfExpression(value);
|
|
72289
|
-
|
|
72290
|
-
assumeTrue &&
|
|
72291
|
-
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
72292
|
-
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
72293
|
-
return valueType;
|
|
72294
|
-
}
|
|
72295
|
-
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72296
|
-
return nonPrimitiveType;
|
|
72297
|
-
}
|
|
72298
|
-
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72299
|
-
return type;
|
|
72300
|
-
}
|
|
72301
|
-
}
|
|
72291
|
+
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72302
72292
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
72303
72293
|
if (!strictNullChecks) {
|
|
72304
72294
|
return type;
|
|
72305
72295
|
}
|
|
72306
|
-
var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */;
|
|
72307
72296
|
var facts = doubleEquals ?
|
|
72308
72297
|
assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ :
|
|
72309
72298
|
valueType.flags & 65536 /* TypeFlags.Null */ ?
|
|
@@ -72312,10 +72301,16 @@ var ts;
|
|
|
72312
72301
|
return getAdjustedTypeWithFacts(type, facts);
|
|
72313
72302
|
}
|
|
72314
72303
|
if (assumeTrue) {
|
|
72315
|
-
|
|
72316
|
-
|
|
72317
|
-
|
|
72318
|
-
|
|
72304
|
+
if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
72305
|
+
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
72306
|
+
return valueType;
|
|
72307
|
+
}
|
|
72308
|
+
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72309
|
+
return nonPrimitiveType;
|
|
72310
|
+
}
|
|
72311
|
+
}
|
|
72312
|
+
var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); });
|
|
72313
|
+
return replacePrimitivesWithLiterals(filteredType, valueType);
|
|
72319
72314
|
}
|
|
72320
72315
|
if (isUnitType(valueType)) {
|
|
72321
72316
|
return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); });
|
|
@@ -75804,10 +75799,27 @@ var ts;
|
|
|
75804
75799
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
75805
75800
|
}
|
|
75806
75801
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
75807
|
-
|
|
75808
|
-
|
|
75809
|
-
ts.Diagnostics.
|
|
75810
|
-
|
|
75802
|
+
var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined;
|
|
75803
|
+
if (node.kind === 104 /* SyntaxKind.NullKeyword */) {
|
|
75804
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
75805
|
+
return;
|
|
75806
|
+
}
|
|
75807
|
+
if (nodeText !== undefined && nodeText.length < 100) {
|
|
75808
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75809
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
75810
|
+
return;
|
|
75811
|
+
}
|
|
75812
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75813
|
+
ts.Diagnostics._0_is_possibly_null_or_undefined :
|
|
75814
|
+
ts.Diagnostics._0_is_possibly_undefined :
|
|
75815
|
+
ts.Diagnostics._0_is_possibly_null, nodeText);
|
|
75816
|
+
}
|
|
75817
|
+
else {
|
|
75818
|
+
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
75819
|
+
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
75820
|
+
ts.Diagnostics.Object_is_possibly_undefined :
|
|
75821
|
+
ts.Diagnostics.Object_is_possibly_null);
|
|
75822
|
+
}
|
|
75811
75823
|
}
|
|
75812
75824
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
75813
75825
|
error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ?
|
|
@@ -75817,6 +75829,13 @@ var ts;
|
|
|
75817
75829
|
}
|
|
75818
75830
|
function checkNonNullTypeWithReporter(type, node, reportError) {
|
|
75819
75831
|
if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) {
|
|
75832
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75833
|
+
var nodeText = ts.entityNameToString(node);
|
|
75834
|
+
if (nodeText.length < 100) {
|
|
75835
|
+
error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText);
|
|
75836
|
+
return errorType;
|
|
75837
|
+
}
|
|
75838
|
+
}
|
|
75820
75839
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
75821
75840
|
return errorType;
|
|
75822
75841
|
}
|
|
@@ -75834,6 +75853,17 @@ var ts;
|
|
|
75834
75853
|
function checkNonNullNonVoidType(type, node) {
|
|
75835
75854
|
var nonNullType = checkNonNullType(type, node);
|
|
75836
75855
|
if (nonNullType.flags & 16384 /* TypeFlags.Void */) {
|
|
75856
|
+
if (ts.isEntityNameExpression(node)) {
|
|
75857
|
+
var nodeText = ts.entityNameToString(node);
|
|
75858
|
+
if (ts.isIdentifier(node) && nodeText === "undefined") {
|
|
75859
|
+
error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText);
|
|
75860
|
+
return nonNullType;
|
|
75861
|
+
}
|
|
75862
|
+
if (nodeText.length < 100) {
|
|
75863
|
+
error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText);
|
|
75864
|
+
return nonNullType;
|
|
75865
|
+
}
|
|
75866
|
+
}
|
|
75837
75867
|
error(node, ts.Diagnostics.Object_is_possibly_undefined);
|
|
75838
75868
|
}
|
|
75839
75869
|
return nonNullType;
|
|
@@ -186,6 +186,7 @@
|
|
|
186
186
|
"An_abstract_accessor_cannot_have_an_implementation_1318": "抽象访问器不能有实现。",
|
|
187
187
|
"An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "可访问性修饰符不能与专用标识符一起使用。",
|
|
188
188
|
"An_accessor_cannot_have_type_parameters_1094": "访问器不能具有类型参数。",
|
|
189
|
+
"An_accessor_property_cannot_be_declared_optional_1276": "\"accessor\" 属性不能声明为可选。",
|
|
189
190
|
"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "只允许在文件的顶层中使用环境模块声明。",
|
|
190
191
|
"An_argument_for_0_was_not_provided_6210": "未提供 \"{0}\" 的自变量。",
|
|
191
192
|
"An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供与此绑定模式匹配的自变量。",
|
|
@@ -1112,6 +1113,7 @@
|
|
|
1112
1113
|
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "项目引用不能形成环形图。检测到循环: {0}",
|
|
1113
1114
|
"Projects_6255": "项目",
|
|
1114
1115
|
"Projects_in_this_build_Colon_0_6355": "此生成中的项目: {0}",
|
|
1116
|
+
"Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有在面向 ECMAScript 2015 及更高版本时,才可使用带有 \"accessor\" 修饰符的属性。",
|
|
1115
1117
|
"Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "属性“{0}”不能具有初始化表杰式,因为它标记为摘要。",
|
|
1116
1118
|
"Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "属性“{0}”来自索引签名,因此必须使用[“{0}”]访问它。",
|
|
1117
1119
|
"Property_0_does_not_exist_on_type_1_2339": "类型“{1}”上不存在属性“{0}”。",
|
|
@@ -1761,6 +1763,7 @@
|
|
|
1761
1763
|
"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少返回类型批注的“{0}”隐式具有“{1}”返回类型。",
|
|
1762
1764
|
"_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少返回类型批注的 \"{0}\" 隐式具有 \"{1}\" 产出类型。",
|
|
1763
1765
|
"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "\"abstract\" 修饰符仅可出现在类、方法或属性声明中。",
|
|
1766
|
+
"accessor_modifier_can_only_appear_on_a_property_declaration_1275": "\"accessor\" 修饰符只能出现在属性声明中。",
|
|
1764
1767
|
"and_here_6204": "并在这里。",
|
|
1765
1768
|
"arguments_cannot_be_referenced_in_property_initializers_2815": "无法在属性初始化表达式中引用 \"arguments\"。",
|
|
1766
1769
|
"auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "“auto”: 将带有导入、导出、import.meta、jsx (带有 jsx: react-jsx)或 esm 格式(带模块: node16+)的文件视为模块。",
|
|
@@ -186,6 +186,7 @@
|
|
|
186
186
|
"An_abstract_accessor_cannot_have_an_implementation_1318": "抽象存取子無法實作。",
|
|
187
187
|
"An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "協助工具修飾元不可搭配私人識別碼使用。",
|
|
188
188
|
"An_accessor_cannot_have_type_parameters_1094": "存取子不得有類型參數。",
|
|
189
|
+
"An_accessor_property_cannot_be_declared_optional_1276": "無法將 'accessor' 屬性宣告為選擇性。",
|
|
189
190
|
"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "環境模組宣告只可出現在檔案的最上層。",
|
|
190
191
|
"An_argument_for_0_was_not_provided_6210": "未提供 '{0}' 的引數。",
|
|
191
192
|
"An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供符合此繫結模式的引數。",
|
|
@@ -1112,6 +1113,7 @@
|
|
|
1112
1113
|
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "專案參考不會形成循環圖。但偵測到循環: {0}",
|
|
1113
1114
|
"Projects_6255": "專案",
|
|
1114
1115
|
"Projects_in_this_build_Colon_0_6355": "此組建中的專案: {0}",
|
|
1116
|
+
"Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有以 ECMAScript 2015 及更新版本為目標時,才可使用具有 'accessor' 修飾詞的屬性。",
|
|
1115
1117
|
"Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "屬性 '{0}' 已標記為抽象,因此不得有初始設定式。",
|
|
1116
1118
|
"Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "屬性 '{0}' 來自索引簽章,因此必須使用 ['{0}'] 存取。",
|
|
1117
1119
|
"Property_0_does_not_exist_on_type_1_2339": "類型 '{1}' 沒有屬性 '{0}'。",
|
|
@@ -1761,6 +1763,7 @@
|
|
|
1761
1763
|
"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少傳回型別註解的 '{0}' 隱含了 '{1}' 傳回型別。",
|
|
1762
1764
|
"_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少傳回型別註解的 '{0}' 隱含 '{1}' 產生類型。",
|
|
1763
1765
|
"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 修飾元只能出現在類別宣告、方法宣告或屬性宣告。",
|
|
1766
|
+
"accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 修飾詞只能出現在屬性宣告。",
|
|
1764
1767
|
"and_here_6204": "及此處。",
|
|
1765
1768
|
"arguments_cannot_be_referenced_in_property_initializers_2815": "屬性初始設定式中不得參考 'arguments'。",
|
|
1766
1769
|
"auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": 處理具有 imports、exports、import.meta, jsx (具有 jsx: react-jsx) 的檔案,或以 esm 格式 (具有 module: node16+) 作為模組。",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.9.0-dev.
|
|
5
|
+
"version": "4.9.0-dev.20220916",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|