typescript 4.8.0-dev.20220529 → 4.8.0-dev.20220601
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 +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +131 -127
- package/lib/tsserver.js +169 -150
- package/lib/tsserverlibrary.js +169 -150
- package/lib/typescript.js +169 -150
- package/lib/typescriptServices.js +169 -150
- package/lib/typingsInstaller.js +149 -147
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
- package/test.js +9 -0
- package/test.ts +4 -0
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 = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220601";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8894,6 +8894,7 @@ var ts;
|
|
|
8894
8894
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8895
8895
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
8896
8896
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
8897
|
+
An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
|
|
8897
8898
|
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}'."),
|
|
8898
8899
|
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}'."),
|
|
8899
8900
|
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}'."),
|
|
@@ -44163,8 +44164,8 @@ var ts;
|
|
|
44163
44164
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44164
44165
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44165
44166
|
if (!pathAndExtension && packageInfo
|
|
44166
|
-
|
|
44167
|
-
&& packageInfo.packageJsonContent.
|
|
44167
|
+
// eslint-disable-next-line no-null/no-null
|
|
44168
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44168
44169
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44169
44170
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44170
44171
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -47829,7 +47830,10 @@ var ts;
|
|
|
47829
47830
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
47830
47831
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
47831
47832
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
47832
|
-
TypeFacts[TypeFacts["
|
|
47833
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
47834
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
47835
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
47836
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
47833
47837
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
47834
47838
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
47835
47839
|
// of that kind of type.
|
|
@@ -47871,14 +47875,16 @@ var ts;
|
|
|
47871
47875
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
47872
47876
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
47873
47877
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
47874
|
-
TypeFacts[TypeFacts["
|
|
47875
|
-
TypeFacts[TypeFacts["
|
|
47876
|
-
TypeFacts[TypeFacts["
|
|
47878
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
47879
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
47880
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
47881
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
47882
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
47883
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
47877
47884
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
47878
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
47879
47885
|
// Masks
|
|
47880
47886
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
47881
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
47887
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
47882
47888
|
})(TypeFacts || (TypeFacts = {}));
|
|
47883
47889
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
47884
47890
|
string: 1 /* TypeofEQString */,
|
|
@@ -50042,7 +50048,12 @@ var ts;
|
|
|
50042
50048
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50043
50049
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50044
50050
|
if (isPrimitiveTypeName(name)) {
|
|
50045
|
-
|
|
50051
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50052
|
+
error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
|
|
50053
|
+
}
|
|
50054
|
+
else {
|
|
50055
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50056
|
+
}
|
|
50046
50057
|
return true;
|
|
50047
50058
|
}
|
|
50048
50059
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50062,6 +50073,16 @@ var ts;
|
|
|
50062
50073
|
}
|
|
50063
50074
|
return false;
|
|
50064
50075
|
}
|
|
50076
|
+
function isExtendedByInterface(node) {
|
|
50077
|
+
var grandparent = node.parent.parent;
|
|
50078
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50079
|
+
if (grandparent && parentOfGrandparent) {
|
|
50080
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50081
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50082
|
+
return isExtending && isInterface;
|
|
50083
|
+
}
|
|
50084
|
+
return false;
|
|
50085
|
+
}
|
|
50065
50086
|
function maybeMappedType(node, symbol) {
|
|
50066
50087
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50067
50088
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -52902,7 +52923,7 @@ var ts;
|
|
|
52902
52923
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
52903
52924
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52904
52925
|
context.enclosingDeclaration = undefined;
|
|
52905
|
-
if (context.tracker.trackSymbol &&
|
|
52926
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
52906
52927
|
if (propertySymbol.declarations) {
|
|
52907
52928
|
var decl = ts.first(propertySymbol.declarations);
|
|
52908
52929
|
if (hasLateBindableName(decl)) {
|
|
@@ -54586,7 +54607,7 @@ var ts;
|
|
|
54586
54607
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54587
54608
|
: anyType;
|
|
54588
54609
|
var heritageClauses = __spreadArray(__spreadArray([], !ts.length(baseTypes) ? [] : [ts.factory.createHeritageClause(94 /* ExtendsKeyword */, ts.map(baseTypes, function (b) { return serializeBaseType(b, staticBaseType, localName); }))], true), !ts.length(implementsExpressions) ? [] : [ts.factory.createHeritageClause(117 /* ImplementsKeyword */, implementsExpressions)], true);
|
|
54589
|
-
var symbolProps =
|
|
54610
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54590
54611
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54591
54612
|
// `valueDeclaration` could be undefined if inherited from
|
|
54592
54613
|
// a union/intersection base type, but inherited properties
|
|
@@ -55724,7 +55745,7 @@ var ts;
|
|
|
55724
55745
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55725
55746
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55726
55747
|
// undefined from the final type.
|
|
55727
|
-
return strictNullChecks && !(
|
|
55748
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55728
55749
|
}
|
|
55729
55750
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55730
55751
|
}
|
|
@@ -64219,7 +64240,7 @@ var ts;
|
|
|
64219
64240
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64220
64241
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64221
64242
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64222
|
-
(
|
|
64243
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64223
64244
|
var related = callbacks ?
|
|
64224
64245
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64225
64246
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67437,30 +67458,8 @@ var ts;
|
|
|
67437
67458
|
var value = _a.value;
|
|
67438
67459
|
return value.base10Value === "0";
|
|
67439
67460
|
}
|
|
67440
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67441
|
-
var result = 0;
|
|
67442
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67443
|
-
var t = types_14[_i];
|
|
67444
|
-
result |= getFalsyFlags(t);
|
|
67445
|
-
}
|
|
67446
|
-
return result;
|
|
67447
|
-
}
|
|
67448
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67449
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67450
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67451
|
-
function getFalsyFlags(type) {
|
|
67452
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67453
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67454
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67455
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67456
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67457
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67458
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67459
|
-
}
|
|
67460
67461
|
function removeDefinitelyFalsyTypes(type) {
|
|
67461
|
-
return
|
|
67462
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67463
|
-
type;
|
|
67462
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67464
67463
|
}
|
|
67465
67464
|
function extractDefinitelyFalsyTypes(type) {
|
|
67466
67465
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67503,14 +67502,7 @@ var ts;
|
|
|
67503
67502
|
getIntersectionType([type, emptyObjectType]);
|
|
67504
67503
|
}
|
|
67505
67504
|
function getNonNullableType(type) {
|
|
67506
|
-
|
|
67507
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67508
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67509
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67510
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67511
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67512
|
-
}
|
|
67513
|
-
return type;
|
|
67505
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67514
67506
|
}
|
|
67515
67507
|
function addOptionalTypeMarker(type) {
|
|
67516
67508
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68654,8 +68646,8 @@ var ts;
|
|
|
68654
68646
|
}
|
|
68655
68647
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68656
68648
|
var typeVariable;
|
|
68657
|
-
for (var _i = 0,
|
|
68658
|
-
var type =
|
|
68649
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68650
|
+
var type = types_14[_i];
|
|
68659
68651
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68660
68652
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68661
68653
|
return undefined;
|
|
@@ -69408,8 +69400,8 @@ var ts;
|
|
|
69408
69400
|
}
|
|
69409
69401
|
}
|
|
69410
69402
|
};
|
|
69411
|
-
for (var _i = 0,
|
|
69412
|
-
var type =
|
|
69403
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69404
|
+
var type = types_15[_i];
|
|
69413
69405
|
var state_9 = _loop_24(type);
|
|
69414
69406
|
if (typeof state_9 === "object")
|
|
69415
69407
|
return state_9.value;
|
|
@@ -69524,14 +69516,16 @@ var ts;
|
|
|
69524
69516
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69525
69517
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69526
69518
|
}
|
|
69527
|
-
function getTypeFacts(type
|
|
69528
|
-
if (
|
|
69519
|
+
function getTypeFacts(type) {
|
|
69520
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69521
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69522
|
+
}
|
|
69529
69523
|
var flags = type.flags;
|
|
69530
|
-
if (flags & 4 /* String */) {
|
|
69524
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69531
69525
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69532
69526
|
}
|
|
69533
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69534
|
-
var isEmpty = type.value === "";
|
|
69527
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69528
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69535
69529
|
return strictNullChecks ?
|
|
69536
69530
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69537
69531
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69563,20 +69557,20 @@ var ts;
|
|
|
69563
69557
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69564
69558
|
}
|
|
69565
69559
|
if (flags & 524288 /* Object */) {
|
|
69566
|
-
if (ignoreObjects) {
|
|
69567
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69568
|
-
}
|
|
69569
69560
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69570
|
-
strictNullChecks ?
|
|
69561
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69571
69562
|
isFunctionObjectType(type) ?
|
|
69572
69563
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69573
69564
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69574
69565
|
}
|
|
69575
|
-
if (flags &
|
|
69576
|
-
return 9830144 /*
|
|
69566
|
+
if (flags & 16384 /* Void */) {
|
|
69567
|
+
return 9830144 /* VoidFacts */;
|
|
69568
|
+
}
|
|
69569
|
+
if (flags & 32768 /* Undefined */) {
|
|
69570
|
+
return 26607360 /* UndefinedFacts */;
|
|
69577
69571
|
}
|
|
69578
69572
|
if (flags & 65536 /* Null */) {
|
|
69579
|
-
return
|
|
69573
|
+
return 42917664 /* NullFacts */;
|
|
69580
69574
|
}
|
|
69581
69575
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69582
69576
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69587,38 +69581,39 @@ var ts;
|
|
|
69587
69581
|
if (flags & 131072 /* Never */) {
|
|
69588
69582
|
return 0 /* None */;
|
|
69589
69583
|
}
|
|
69590
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69591
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69592
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69593
|
-
}
|
|
69594
69584
|
if (flags & 1048576 /* Union */) {
|
|
69595
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69585
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69596
69586
|
}
|
|
69597
69587
|
if (flags & 2097152 /* Intersection */) {
|
|
69598
|
-
|
|
69599
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69600
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69601
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69588
|
+
return getIntersectionTypeFacts(type);
|
|
69602
69589
|
}
|
|
69603
|
-
return
|
|
69590
|
+
return 83886079 /* UnknownFacts */;
|
|
69604
69591
|
}
|
|
69605
|
-
function getIntersectionTypeFacts(type
|
|
69592
|
+
function getIntersectionTypeFacts(type) {
|
|
69593
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69594
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69595
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69606
69596
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69607
69597
|
// and others are computed as `or`.
|
|
69608
69598
|
var oredFacts = 0 /* None */;
|
|
69609
|
-
var andedFacts =
|
|
69599
|
+
var andedFacts = 134217727 /* All */;
|
|
69610
69600
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69611
69601
|
var t = _a[_i];
|
|
69612
|
-
|
|
69613
|
-
|
|
69614
|
-
|
|
69602
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69603
|
+
var f = getTypeFacts(t);
|
|
69604
|
+
oredFacts |= f;
|
|
69605
|
+
andedFacts &= f;
|
|
69606
|
+
}
|
|
69615
69607
|
}
|
|
69616
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69608
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69617
69609
|
}
|
|
69618
69610
|
function getTypeWithFacts(type, include) {
|
|
69619
69611
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69620
69612
|
}
|
|
69621
|
-
function
|
|
69613
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69614
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69615
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69616
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69622
69617
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69623
69618
|
if (strictNullChecks) {
|
|
69624
69619
|
switch (facts) {
|
|
@@ -69884,8 +69879,8 @@ var ts;
|
|
|
69884
69879
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
69885
69880
|
var mappedTypes;
|
|
69886
69881
|
var changed = false;
|
|
69887
|
-
for (var _i = 0,
|
|
69888
|
-
var t =
|
|
69882
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
69883
|
+
var t = types_16[_i];
|
|
69889
69884
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
69890
69885
|
changed || (changed = t !== mapped);
|
|
69891
69886
|
if (mapped) {
|
|
@@ -69971,8 +69966,8 @@ var ts;
|
|
|
69971
69966
|
}
|
|
69972
69967
|
function isEvolvingArrayTypeList(types) {
|
|
69973
69968
|
var hasEvolvingArrayType = false;
|
|
69974
|
-
for (var _i = 0,
|
|
69975
|
-
var t =
|
|
69969
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
69970
|
+
var t = types_17[_i];
|
|
69976
69971
|
if (!(t.flags & 131072 /* Never */)) {
|
|
69977
69972
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
69978
69973
|
return false;
|
|
@@ -70795,10 +70790,10 @@ var ts;
|
|
|
70795
70790
|
}
|
|
70796
70791
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
70797
70792
|
if (isMatchingReference(reference, expr)) {
|
|
70798
|
-
return
|
|
70793
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
70799
70794
|
}
|
|
70800
70795
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
70801
|
-
type =
|
|
70796
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70802
70797
|
}
|
|
70803
70798
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
70804
70799
|
if (access) {
|
|
@@ -70938,7 +70933,7 @@ var ts;
|
|
|
70938
70933
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
70939
70934
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
70940
70935
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
70941
|
-
return removeNullable ?
|
|
70936
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
70942
70937
|
}
|
|
70943
70938
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
70944
70939
|
if (type.flags & 1 /* Any */) {
|
|
@@ -70967,7 +70962,7 @@ var ts;
|
|
|
70967
70962
|
valueType.flags & 65536 /* Null */ ?
|
|
70968
70963
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
70969
70964
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
70970
|
-
return
|
|
70965
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
70971
70966
|
}
|
|
70972
70967
|
if (assumeTrue) {
|
|
70973
70968
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -70988,7 +70983,7 @@ var ts;
|
|
|
70988
70983
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
70989
70984
|
if (!isMatchingReference(reference, target)) {
|
|
70990
70985
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
70991
|
-
return
|
|
70986
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70992
70987
|
}
|
|
70993
70988
|
return type;
|
|
70994
70989
|
}
|
|
@@ -71192,7 +71187,7 @@ var ts;
|
|
|
71192
71187
|
var left = getReferenceCandidate(expr.left);
|
|
71193
71188
|
if (!isMatchingReference(reference, left)) {
|
|
71194
71189
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71195
|
-
return
|
|
71190
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71196
71191
|
}
|
|
71197
71192
|
return type;
|
|
71198
71193
|
}
|
|
@@ -71280,7 +71275,7 @@ var ts;
|
|
|
71280
71275
|
}
|
|
71281
71276
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71282
71277
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71283
|
-
type =
|
|
71278
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71284
71279
|
}
|
|
71285
71280
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71286
71281
|
if (access) {
|
|
@@ -71337,7 +71332,7 @@ var ts;
|
|
|
71337
71332
|
}
|
|
71338
71333
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71339
71334
|
if (isMatchingReference(reference, expr)) {
|
|
71340
|
-
return
|
|
71335
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71341
71336
|
}
|
|
71342
71337
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71343
71338
|
if (access) {
|
|
@@ -71423,8 +71418,8 @@ var ts;
|
|
|
71423
71418
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71424
71419
|
declaration.kind === 164 /* Parameter */ &&
|
|
71425
71420
|
declaration.initializer &&
|
|
71426
|
-
|
|
71427
|
-
!(
|
|
71421
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71422
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71428
71423
|
popTypeResolution();
|
|
71429
71424
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71430
71425
|
}
|
|
@@ -71752,7 +71747,7 @@ var ts;
|
|
|
71752
71747
|
return convertAutoToAny(flowType);
|
|
71753
71748
|
}
|
|
71754
71749
|
}
|
|
71755
|
-
else if (!assumeInitialized && !(
|
|
71750
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71756
71751
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71757
71752
|
// Return the declared type to reduce follow-on errors
|
|
71758
71753
|
return type;
|
|
@@ -73281,8 +73276,8 @@ var ts;
|
|
|
73281
73276
|
}
|
|
73282
73277
|
var signatureList;
|
|
73283
73278
|
var types = type.types;
|
|
73284
|
-
for (var _i = 0,
|
|
73285
|
-
var current =
|
|
73279
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73280
|
+
var current = types_18[_i];
|
|
73286
73281
|
var signature = getContextualCallSignature(current, node);
|
|
73287
73282
|
if (signature) {
|
|
73288
73283
|
if (!signatureList) {
|
|
@@ -74444,19 +74439,19 @@ var ts;
|
|
|
74444
74439
|
return checkNonNullType(checkExpression(node), node);
|
|
74445
74440
|
}
|
|
74446
74441
|
function isNullableType(type) {
|
|
74447
|
-
return !!((
|
|
74442
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74448
74443
|
}
|
|
74449
74444
|
function getNonNullableTypeIfNeeded(type) {
|
|
74450
74445
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74451
74446
|
}
|
|
74452
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74453
|
-
error(node,
|
|
74447
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74448
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74454
74449
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74455
74450
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74456
74451
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74457
74452
|
}
|
|
74458
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74459
|
-
error(node,
|
|
74453
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74454
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74460
74455
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74461
74456
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74462
74457
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74466,9 +74461,9 @@ var ts;
|
|
|
74466
74461
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74467
74462
|
return errorType;
|
|
74468
74463
|
}
|
|
74469
|
-
var
|
|
74470
|
-
if (
|
|
74471
|
-
reportError(node,
|
|
74464
|
+
var facts = getTypeFacts(type);
|
|
74465
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74466
|
+
reportError(node, facts);
|
|
74472
74467
|
var t = getNonNullableType(type);
|
|
74473
74468
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74474
74469
|
}
|
|
@@ -74763,7 +74758,7 @@ var ts;
|
|
|
74763
74758
|
assumeUninitialized = true;
|
|
74764
74759
|
}
|
|
74765
74760
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74766
|
-
if (assumeUninitialized && !(
|
|
74761
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74767
74762
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74768
74763
|
// Return the declared type to reduce follow-on errors
|
|
74769
74764
|
return propType;
|
|
@@ -76679,8 +76674,8 @@ var ts;
|
|
|
76679
76674
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76680
76675
|
var types = apparentType.types;
|
|
76681
76676
|
var hasSignatures = false;
|
|
76682
|
-
for (var _i = 0,
|
|
76683
|
-
var constituent =
|
|
76677
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76678
|
+
var constituent = types_19[_i];
|
|
76684
76679
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76685
76680
|
if (signatures.length !== 0) {
|
|
76686
76681
|
hasSignatures = true;
|
|
@@ -78371,7 +78366,7 @@ var ts;
|
|
|
78371
78366
|
var type = getTypeOfSymbol(symbol);
|
|
78372
78367
|
if (strictNullChecks &&
|
|
78373
78368
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78374
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78369
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78375
78370
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78376
78371
|
}
|
|
78377
78372
|
}
|
|
@@ -78539,8 +78534,8 @@ var ts;
|
|
|
78539
78534
|
}
|
|
78540
78535
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78541
78536
|
var types = type.types;
|
|
78542
|
-
for (var _i = 0,
|
|
78543
|
-
var t =
|
|
78537
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78538
|
+
var t = types_20[_i];
|
|
78544
78539
|
if (maybeTypeOfKind(t, kind)) {
|
|
78545
78540
|
return true;
|
|
78546
78541
|
}
|
|
@@ -78767,7 +78762,7 @@ var ts;
|
|
|
78767
78762
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78768
78763
|
// undefined from the final type.
|
|
78769
78764
|
if (strictNullChecks &&
|
|
78770
|
-
!(
|
|
78765
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78771
78766
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78772
78767
|
}
|
|
78773
78768
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -79167,7 +79162,7 @@ var ts;
|
|
|
79167
79162
|
case 56 /* BarBarToken */:
|
|
79168
79163
|
case 75 /* BarBarEqualsToken */: {
|
|
79169
79164
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79170
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79165
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79171
79166
|
leftType;
|
|
79172
79167
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79173
79168
|
checkAssignmentOperator(rightType);
|
|
@@ -81708,8 +81703,8 @@ var ts;
|
|
|
81708
81703
|
}
|
|
81709
81704
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81710
81705
|
var commonEntityName;
|
|
81711
|
-
for (var _i = 0,
|
|
81712
|
-
var typeNode =
|
|
81706
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81707
|
+
var typeNode = types_21[_i];
|
|
81713
81708
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81714
81709
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81715
81710
|
}
|
|
@@ -82575,7 +82570,7 @@ var ts;
|
|
|
82575
82570
|
// For a binding pattern, validate the initializer and exit
|
|
82576
82571
|
if (ts.isBindingPattern(node.name)) {
|
|
82577
82572
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82578
|
-
var needCheckWidenedType = node.name.elements.
|
|
82573
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82579
82574
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82580
82575
|
// Don't validate for-in initializer as it is already an error
|
|
82581
82576
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82728,7 +82723,7 @@ var ts;
|
|
|
82728
82723
|
return;
|
|
82729
82724
|
var type = checkTruthinessExpression(location);
|
|
82730
82725
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82731
|
-
if (
|
|
82726
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82732
82727
|
return;
|
|
82733
82728
|
// While it technically should be invalid for any known-truthy value
|
|
82734
82729
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84414,18 +84409,17 @@ var ts;
|
|
|
84414
84409
|
// but not by other kinds of members.
|
|
84415
84410
|
// Base class instance member variables and accessors can be overridden by
|
|
84416
84411
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84417
|
-
var _a, _b;
|
|
84412
|
+
var _a, _b, _c, _d;
|
|
84418
84413
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84419
84414
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84420
|
-
|
|
84421
|
-
var baseProperty = baseProperties_1[_i];
|
|
84415
|
+
var _loop_33 = function (baseProperty) {
|
|
84422
84416
|
var base = getTargetSymbol(baseProperty);
|
|
84423
84417
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84424
|
-
continue;
|
|
84418
|
+
return "continue";
|
|
84425
84419
|
}
|
|
84426
84420
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84427
84421
|
if (!baseSymbol) {
|
|
84428
|
-
continue;
|
|
84422
|
+
return "continue";
|
|
84429
84423
|
}
|
|
84430
84424
|
var derived = getTargetSymbol(baseSymbol);
|
|
84431
84425
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84443,14 +84437,14 @@ var ts;
|
|
|
84443
84437
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84444
84438
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84445
84439
|
// same name.)
|
|
84446
|
-
for (var
|
|
84447
|
-
var otherBaseType =
|
|
84440
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84441
|
+
var otherBaseType = _f[_e];
|
|
84448
84442
|
if (otherBaseType === baseType)
|
|
84449
84443
|
continue;
|
|
84450
84444
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84451
84445
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84452
84446
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84453
|
-
continue
|
|
84447
|
+
return "continue-basePropertyCheck";
|
|
84454
84448
|
}
|
|
84455
84449
|
}
|
|
84456
84450
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84465,20 +84459,19 @@ var ts;
|
|
|
84465
84459
|
// derived overrides base.
|
|
84466
84460
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84467
84461
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84468
|
-
|
|
84469
|
-
continue;
|
|
84462
|
+
return "continue";
|
|
84470
84463
|
}
|
|
84471
84464
|
var errorMessage = void 0;
|
|
84472
84465
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84473
84466
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84474
84467
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84475
84468
|
// property/accessor is overridden with property/accessor
|
|
84476
|
-
if (
|
|
84477
|
-
|
|
84469
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84470
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84471
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84472
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84478
84473
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84479
|
-
|
|
84480
|
-
// same when the derived property is from an assignment
|
|
84481
|
-
continue;
|
|
84474
|
+
return "continue";
|
|
84482
84475
|
}
|
|
84483
84476
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84484
84477
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84489,12 +84482,12 @@ var ts;
|
|
|
84489
84482
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84490
84483
|
}
|
|
84491
84484
|
else if (useDefineForClassFields) {
|
|
84492
|
-
var uninitialized = (
|
|
84485
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84493
84486
|
if (uninitialized
|
|
84494
84487
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84495
84488
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84496
84489
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84497
|
-
&& !((
|
|
84490
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84498
84491
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84499
84492
|
var propName = uninitialized.name;
|
|
84500
84493
|
if (uninitialized.exclamationToken
|
|
@@ -84507,13 +84500,11 @@ var ts;
|
|
|
84507
84500
|
}
|
|
84508
84501
|
}
|
|
84509
84502
|
}
|
|
84510
|
-
|
|
84511
|
-
continue;
|
|
84503
|
+
return "continue";
|
|
84512
84504
|
}
|
|
84513
84505
|
else if (isPrototypeProperty(base)) {
|
|
84514
84506
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84515
|
-
|
|
84516
|
-
continue;
|
|
84507
|
+
return "continue";
|
|
84517
84508
|
}
|
|
84518
84509
|
else {
|
|
84519
84510
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84528,9 +84519,20 @@ var ts;
|
|
|
84528
84519
|
}
|
|
84529
84520
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84530
84521
|
}
|
|
84522
|
+
};
|
|
84523
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84524
|
+
var baseProperty = baseProperties_1[_i];
|
|
84525
|
+
var state_10 = _loop_33(baseProperty);
|
|
84526
|
+
switch (state_10) {
|
|
84527
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84528
|
+
}
|
|
84531
84529
|
}
|
|
84532
84530
|
}
|
|
84533
|
-
function
|
|
84531
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84532
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84533
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84534
|
+
}
|
|
84535
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84534
84536
|
if (!ts.length(baseTypes)) {
|
|
84535
84537
|
return properties;
|
|
84536
84538
|
}
|
|
@@ -84599,7 +84601,7 @@ var ts;
|
|
|
84599
84601
|
var propName = member.name;
|
|
84600
84602
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84601
84603
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84602
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84604
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84603
84605
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84604
84606
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84605
84607
|
}
|
|
@@ -84624,7 +84626,7 @@ var ts;
|
|
|
84624
84626
|
ts.setParent(reference, staticBlock);
|
|
84625
84627
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84626
84628
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84627
|
-
if (!(
|
|
84629
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84628
84630
|
return true;
|
|
84629
84631
|
}
|
|
84630
84632
|
}
|
|
@@ -84639,7 +84641,7 @@ var ts;
|
|
|
84639
84641
|
ts.setParent(reference, constructor);
|
|
84640
84642
|
reference.flowNode = constructor.returnFlowNode;
|
|
84641
84643
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84642
|
-
return !(
|
|
84644
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84643
84645
|
}
|
|
84644
84646
|
function checkInterfaceDeclaration(node) {
|
|
84645
84647
|
// Grammar checking
|
|
@@ -92929,8 +92931,8 @@ var ts;
|
|
|
92929
92931
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
92930
92932
|
// so that aliases can be marked as referenced
|
|
92931
92933
|
var serializedUnion;
|
|
92932
|
-
for (var _i = 0,
|
|
92933
|
-
var typeNode =
|
|
92934
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
92935
|
+
var typeNode = types_22[_i];
|
|
92934
92936
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
92935
92937
|
typeNode = typeNode.type; // Skip parens if need be
|
|
92936
92938
|
}
|
|
@@ -113545,8 +113547,8 @@ var ts;
|
|
|
113545
113547
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113546
113548
|
writeLine();
|
|
113547
113549
|
}
|
|
113548
|
-
for (var _d = 0,
|
|
113549
|
-
var directive =
|
|
113550
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113551
|
+
var directive = types_23[_d];
|
|
113550
113552
|
var pos = writer.getTextPos();
|
|
113551
113553
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113552
113554
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -122314,7 +122316,7 @@ var ts;
|
|
|
122314
122316
|
});
|
|
122315
122317
|
// Sort by paths closest to importing file Name directory
|
|
122316
122318
|
var sortedPaths = [];
|
|
122317
|
-
var
|
|
122319
|
+
var _loop_34 = function (directory) {
|
|
122318
122320
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122319
122321
|
var pathsInDirectory;
|
|
122320
122322
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122338,9 +122340,9 @@ var ts;
|
|
|
122338
122340
|
};
|
|
122339
122341
|
var out_directory_1;
|
|
122340
122342
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122341
|
-
var
|
|
122343
|
+
var state_11 = _loop_34(directory);
|
|
122342
122344
|
directory = out_directory_1;
|
|
122343
|
-
if (
|
|
122345
|
+
if (state_11 === "break")
|
|
122344
122346
|
break;
|
|
122345
122347
|
}
|
|
122346
122348
|
if (allFileNames.size) {
|