typescript 4.8.0-dev.20220530 → 4.8.0-dev.20220602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +135 -128
- package/lib/tsserver.js +174 -151
- package/lib/tsserverlibrary.js +174 -151
- package/lib/typescript.js +174 -151
- package/lib/typescriptServices.js +174 -151
- package/lib/typingsInstaller.js +154 -148
- package/package.json +1 -1
- package/test.js +9 -0
- package/test.ts +4 -0
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220602";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8905,6 +8905,7 @@ var ts;
|
|
|
8905
8905
|
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."),
|
|
8906
8906
|
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."),
|
|
8907
8907
|
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."),
|
|
8908
|
+
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"),
|
|
8908
8909
|
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}'."),
|
|
8909
8910
|
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}'."),
|
|
8910
8911
|
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}'."),
|
|
@@ -44174,8 +44175,8 @@ var ts;
|
|
|
44174
44175
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44175
44176
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44176
44177
|
if (!pathAndExtension && packageInfo
|
|
44177
|
-
|
|
44178
|
-
&& packageInfo.packageJsonContent.
|
|
44178
|
+
// eslint-disable-next-line no-null/no-null
|
|
44179
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44179
44180
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44180
44181
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44181
44182
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -47840,7 +47841,10 @@ var ts;
|
|
|
47840
47841
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
47841
47842
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
47842
47843
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
47843
|
-
TypeFacts[TypeFacts["
|
|
47844
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
47845
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
47846
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
47847
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
47844
47848
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
47845
47849
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
47846
47850
|
// of that kind of type.
|
|
@@ -47882,14 +47886,16 @@ var ts;
|
|
|
47882
47886
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
47883
47887
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
47884
47888
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
47885
|
-
TypeFacts[TypeFacts["
|
|
47886
|
-
TypeFacts[TypeFacts["
|
|
47887
|
-
TypeFacts[TypeFacts["
|
|
47889
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
47890
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
47891
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
47892
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
47893
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
47894
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
47888
47895
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
47889
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
47890
47896
|
// Masks
|
|
47891
47897
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
47892
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
47898
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
47893
47899
|
})(TypeFacts || (TypeFacts = {}));
|
|
47894
47900
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
47895
47901
|
string: 1 /* TypeofEQString */,
|
|
@@ -50053,7 +50059,12 @@ var ts;
|
|
|
50053
50059
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50054
50060
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50055
50061
|
if (isPrimitiveTypeName(name)) {
|
|
50056
|
-
|
|
50062
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50063
|
+
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));
|
|
50064
|
+
}
|
|
50065
|
+
else {
|
|
50066
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50067
|
+
}
|
|
50057
50068
|
return true;
|
|
50058
50069
|
}
|
|
50059
50070
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50073,6 +50084,16 @@ var ts;
|
|
|
50073
50084
|
}
|
|
50074
50085
|
return false;
|
|
50075
50086
|
}
|
|
50087
|
+
function isExtendedByInterface(node) {
|
|
50088
|
+
var grandparent = node.parent.parent;
|
|
50089
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50090
|
+
if (grandparent && parentOfGrandparent) {
|
|
50091
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50092
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50093
|
+
return isExtending && isInterface;
|
|
50094
|
+
}
|
|
50095
|
+
return false;
|
|
50096
|
+
}
|
|
50076
50097
|
function maybeMappedType(node, symbol) {
|
|
50077
50098
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50078
50099
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -52913,7 +52934,7 @@ var ts;
|
|
|
52913
52934
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
52914
52935
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52915
52936
|
context.enclosingDeclaration = undefined;
|
|
52916
|
-
if (context.tracker.trackSymbol &&
|
|
52937
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
52917
52938
|
if (propertySymbol.declarations) {
|
|
52918
52939
|
var decl = ts.first(propertySymbol.declarations);
|
|
52919
52940
|
if (hasLateBindableName(decl)) {
|
|
@@ -54597,7 +54618,7 @@ var ts;
|
|
|
54597
54618
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54598
54619
|
: anyType;
|
|
54599
54620
|
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);
|
|
54600
|
-
var symbolProps =
|
|
54621
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54601
54622
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54602
54623
|
// `valueDeclaration` could be undefined if inherited from
|
|
54603
54624
|
// a union/intersection base type, but inherited properties
|
|
@@ -55735,7 +55756,7 @@ var ts;
|
|
|
55735
55756
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55736
55757
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55737
55758
|
// undefined from the final type.
|
|
55738
|
-
return strictNullChecks && !(
|
|
55759
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55739
55760
|
}
|
|
55740
55761
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55741
55762
|
}
|
|
@@ -58938,7 +58959,7 @@ var ts;
|
|
|
58938
58959
|
var objectType;
|
|
58939
58960
|
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58940
58961
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58941
|
-
!objectType
|
|
58962
|
+
!(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58942
58963
|
}
|
|
58943
58964
|
/**
|
|
58944
58965
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -64230,7 +64251,7 @@ var ts;
|
|
|
64230
64251
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64231
64252
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64232
64253
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64233
|
-
(
|
|
64254
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64234
64255
|
var related = callbacks ?
|
|
64235
64256
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64236
64257
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67448,30 +67469,8 @@ var ts;
|
|
|
67448
67469
|
var value = _a.value;
|
|
67449
67470
|
return value.base10Value === "0";
|
|
67450
67471
|
}
|
|
67451
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67452
|
-
var result = 0;
|
|
67453
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67454
|
-
var t = types_14[_i];
|
|
67455
|
-
result |= getFalsyFlags(t);
|
|
67456
|
-
}
|
|
67457
|
-
return result;
|
|
67458
|
-
}
|
|
67459
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67460
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67461
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67462
|
-
function getFalsyFlags(type) {
|
|
67463
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67464
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67465
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67466
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67467
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67468
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67469
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67470
|
-
}
|
|
67471
67472
|
function removeDefinitelyFalsyTypes(type) {
|
|
67472
|
-
return
|
|
67473
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67474
|
-
type;
|
|
67473
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67475
67474
|
}
|
|
67476
67475
|
function extractDefinitelyFalsyTypes(type) {
|
|
67477
67476
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67514,14 +67513,7 @@ var ts;
|
|
|
67514
67513
|
getIntersectionType([type, emptyObjectType]);
|
|
67515
67514
|
}
|
|
67516
67515
|
function getNonNullableType(type) {
|
|
67517
|
-
|
|
67518
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67519
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67520
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67521
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67522
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67523
|
-
}
|
|
67524
|
-
return type;
|
|
67516
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67525
67517
|
}
|
|
67526
67518
|
function addOptionalTypeMarker(type) {
|
|
67527
67519
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68665,8 +68657,8 @@ var ts;
|
|
|
68665
68657
|
}
|
|
68666
68658
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68667
68659
|
var typeVariable;
|
|
68668
|
-
for (var _i = 0,
|
|
68669
|
-
var type =
|
|
68660
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68661
|
+
var type = types_14[_i];
|
|
68670
68662
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68671
68663
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68672
68664
|
return undefined;
|
|
@@ -69419,8 +69411,8 @@ var ts;
|
|
|
69419
69411
|
}
|
|
69420
69412
|
}
|
|
69421
69413
|
};
|
|
69422
|
-
for (var _i = 0,
|
|
69423
|
-
var type =
|
|
69414
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69415
|
+
var type = types_15[_i];
|
|
69424
69416
|
var state_9 = _loop_24(type);
|
|
69425
69417
|
if (typeof state_9 === "object")
|
|
69426
69418
|
return state_9.value;
|
|
@@ -69535,14 +69527,16 @@ var ts;
|
|
|
69535
69527
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69536
69528
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69537
69529
|
}
|
|
69538
|
-
function getTypeFacts(type
|
|
69539
|
-
if (
|
|
69530
|
+
function getTypeFacts(type) {
|
|
69531
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69532
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69533
|
+
}
|
|
69540
69534
|
var flags = type.flags;
|
|
69541
|
-
if (flags & 4 /* String */) {
|
|
69535
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69542
69536
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69543
69537
|
}
|
|
69544
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69545
|
-
var isEmpty = type.value === "";
|
|
69538
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69539
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69546
69540
|
return strictNullChecks ?
|
|
69547
69541
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69548
69542
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69574,20 +69568,20 @@ var ts;
|
|
|
69574
69568
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69575
69569
|
}
|
|
69576
69570
|
if (flags & 524288 /* Object */) {
|
|
69577
|
-
if (ignoreObjects) {
|
|
69578
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69579
|
-
}
|
|
69580
69571
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69581
|
-
strictNullChecks ?
|
|
69572
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69582
69573
|
isFunctionObjectType(type) ?
|
|
69583
69574
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69584
69575
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69585
69576
|
}
|
|
69586
|
-
if (flags &
|
|
69587
|
-
return 9830144 /*
|
|
69577
|
+
if (flags & 16384 /* Void */) {
|
|
69578
|
+
return 9830144 /* VoidFacts */;
|
|
69579
|
+
}
|
|
69580
|
+
if (flags & 32768 /* Undefined */) {
|
|
69581
|
+
return 26607360 /* UndefinedFacts */;
|
|
69588
69582
|
}
|
|
69589
69583
|
if (flags & 65536 /* Null */) {
|
|
69590
|
-
return
|
|
69584
|
+
return 42917664 /* NullFacts */;
|
|
69591
69585
|
}
|
|
69592
69586
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69593
69587
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69598,38 +69592,39 @@ var ts;
|
|
|
69598
69592
|
if (flags & 131072 /* Never */) {
|
|
69599
69593
|
return 0 /* None */;
|
|
69600
69594
|
}
|
|
69601
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69602
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69603
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69604
|
-
}
|
|
69605
69595
|
if (flags & 1048576 /* Union */) {
|
|
69606
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69596
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69607
69597
|
}
|
|
69608
69598
|
if (flags & 2097152 /* Intersection */) {
|
|
69609
|
-
|
|
69610
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69611
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69612
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69599
|
+
return getIntersectionTypeFacts(type);
|
|
69613
69600
|
}
|
|
69614
|
-
return
|
|
69601
|
+
return 83886079 /* UnknownFacts */;
|
|
69615
69602
|
}
|
|
69616
|
-
function getIntersectionTypeFacts(type
|
|
69603
|
+
function getIntersectionTypeFacts(type) {
|
|
69604
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69605
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69606
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69617
69607
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69618
69608
|
// and others are computed as `or`.
|
|
69619
69609
|
var oredFacts = 0 /* None */;
|
|
69620
|
-
var andedFacts =
|
|
69610
|
+
var andedFacts = 134217727 /* All */;
|
|
69621
69611
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69622
69612
|
var t = _a[_i];
|
|
69623
|
-
|
|
69624
|
-
|
|
69625
|
-
|
|
69613
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69614
|
+
var f = getTypeFacts(t);
|
|
69615
|
+
oredFacts |= f;
|
|
69616
|
+
andedFacts &= f;
|
|
69617
|
+
}
|
|
69626
69618
|
}
|
|
69627
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69619
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69628
69620
|
}
|
|
69629
69621
|
function getTypeWithFacts(type, include) {
|
|
69630
69622
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69631
69623
|
}
|
|
69632
|
-
function
|
|
69624
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69625
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69626
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69627
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69633
69628
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69634
69629
|
if (strictNullChecks) {
|
|
69635
69630
|
switch (facts) {
|
|
@@ -69895,8 +69890,8 @@ var ts;
|
|
|
69895
69890
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
69896
69891
|
var mappedTypes;
|
|
69897
69892
|
var changed = false;
|
|
69898
|
-
for (var _i = 0,
|
|
69899
|
-
var t =
|
|
69893
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
69894
|
+
var t = types_16[_i];
|
|
69900
69895
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
69901
69896
|
changed || (changed = t !== mapped);
|
|
69902
69897
|
if (mapped) {
|
|
@@ -69982,8 +69977,8 @@ var ts;
|
|
|
69982
69977
|
}
|
|
69983
69978
|
function isEvolvingArrayTypeList(types) {
|
|
69984
69979
|
var hasEvolvingArrayType = false;
|
|
69985
|
-
for (var _i = 0,
|
|
69986
|
-
var t =
|
|
69980
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
69981
|
+
var t = types_17[_i];
|
|
69987
69982
|
if (!(t.flags & 131072 /* Never */)) {
|
|
69988
69983
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
69989
69984
|
return false;
|
|
@@ -70806,10 +70801,10 @@ var ts;
|
|
|
70806
70801
|
}
|
|
70807
70802
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
70808
70803
|
if (isMatchingReference(reference, expr)) {
|
|
70809
|
-
return
|
|
70804
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
70810
70805
|
}
|
|
70811
70806
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
70812
|
-
type =
|
|
70807
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70813
70808
|
}
|
|
70814
70809
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
70815
70810
|
if (access) {
|
|
@@ -70949,7 +70944,7 @@ var ts;
|
|
|
70949
70944
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
70950
70945
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
70951
70946
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
70952
|
-
return removeNullable ?
|
|
70947
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
70953
70948
|
}
|
|
70954
70949
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
70955
70950
|
if (type.flags & 1 /* Any */) {
|
|
@@ -70978,7 +70973,7 @@ var ts;
|
|
|
70978
70973
|
valueType.flags & 65536 /* Null */ ?
|
|
70979
70974
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
70980
70975
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
70981
|
-
return
|
|
70976
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
70982
70977
|
}
|
|
70983
70978
|
if (assumeTrue) {
|
|
70984
70979
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -70999,7 +70994,7 @@ var ts;
|
|
|
70999
70994
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
71000
70995
|
if (!isMatchingReference(reference, target)) {
|
|
71001
70996
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
71002
|
-
return
|
|
70997
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71003
70998
|
}
|
|
71004
70999
|
return type;
|
|
71005
71000
|
}
|
|
@@ -71203,7 +71198,7 @@ var ts;
|
|
|
71203
71198
|
var left = getReferenceCandidate(expr.left);
|
|
71204
71199
|
if (!isMatchingReference(reference, left)) {
|
|
71205
71200
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71206
|
-
return
|
|
71201
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71207
71202
|
}
|
|
71208
71203
|
return type;
|
|
71209
71204
|
}
|
|
@@ -71291,7 +71286,7 @@ var ts;
|
|
|
71291
71286
|
}
|
|
71292
71287
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71293
71288
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71294
|
-
type =
|
|
71289
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71295
71290
|
}
|
|
71296
71291
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71297
71292
|
if (access) {
|
|
@@ -71348,7 +71343,7 @@ var ts;
|
|
|
71348
71343
|
}
|
|
71349
71344
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71350
71345
|
if (isMatchingReference(reference, expr)) {
|
|
71351
|
-
return
|
|
71346
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71352
71347
|
}
|
|
71353
71348
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71354
71349
|
if (access) {
|
|
@@ -71434,8 +71429,8 @@ var ts;
|
|
|
71434
71429
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71435
71430
|
declaration.kind === 164 /* Parameter */ &&
|
|
71436
71431
|
declaration.initializer &&
|
|
71437
|
-
|
|
71438
|
-
!(
|
|
71432
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71433
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71439
71434
|
popTypeResolution();
|
|
71440
71435
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71441
71436
|
}
|
|
@@ -71763,7 +71758,7 @@ var ts;
|
|
|
71763
71758
|
return convertAutoToAny(flowType);
|
|
71764
71759
|
}
|
|
71765
71760
|
}
|
|
71766
|
-
else if (!assumeInitialized && !(
|
|
71761
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71767
71762
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71768
71763
|
// Return the declared type to reduce follow-on errors
|
|
71769
71764
|
return type;
|
|
@@ -73292,8 +73287,8 @@ var ts;
|
|
|
73292
73287
|
}
|
|
73293
73288
|
var signatureList;
|
|
73294
73289
|
var types = type.types;
|
|
73295
|
-
for (var _i = 0,
|
|
73296
|
-
var current =
|
|
73290
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73291
|
+
var current = types_18[_i];
|
|
73297
73292
|
var signature = getContextualCallSignature(current, node);
|
|
73298
73293
|
if (signature) {
|
|
73299
73294
|
if (!signatureList) {
|
|
@@ -74455,19 +74450,19 @@ var ts;
|
|
|
74455
74450
|
return checkNonNullType(checkExpression(node), node);
|
|
74456
74451
|
}
|
|
74457
74452
|
function isNullableType(type) {
|
|
74458
|
-
return !!((
|
|
74453
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74459
74454
|
}
|
|
74460
74455
|
function getNonNullableTypeIfNeeded(type) {
|
|
74461
74456
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74462
74457
|
}
|
|
74463
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74464
|
-
error(node,
|
|
74458
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74459
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74465
74460
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74466
74461
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74467
74462
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74468
74463
|
}
|
|
74469
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74470
|
-
error(node,
|
|
74464
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74465
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74471
74466
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74472
74467
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74473
74468
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74477,9 +74472,9 @@ var ts;
|
|
|
74477
74472
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74478
74473
|
return errorType;
|
|
74479
74474
|
}
|
|
74480
|
-
var
|
|
74481
|
-
if (
|
|
74482
|
-
reportError(node,
|
|
74475
|
+
var facts = getTypeFacts(type);
|
|
74476
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74477
|
+
reportError(node, facts);
|
|
74483
74478
|
var t = getNonNullableType(type);
|
|
74484
74479
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74485
74480
|
}
|
|
@@ -74774,7 +74769,7 @@ var ts;
|
|
|
74774
74769
|
assumeUninitialized = true;
|
|
74775
74770
|
}
|
|
74776
74771
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74777
|
-
if (assumeUninitialized && !(
|
|
74772
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74778
74773
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74779
74774
|
// Return the declared type to reduce follow-on errors
|
|
74780
74775
|
return propType;
|
|
@@ -76690,8 +76685,8 @@ var ts;
|
|
|
76690
76685
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76691
76686
|
var types = apparentType.types;
|
|
76692
76687
|
var hasSignatures = false;
|
|
76693
|
-
for (var _i = 0,
|
|
76694
|
-
var constituent =
|
|
76688
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76689
|
+
var constituent = types_19[_i];
|
|
76695
76690
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76696
76691
|
if (signatures.length !== 0) {
|
|
76697
76692
|
hasSignatures = true;
|
|
@@ -78382,7 +78377,7 @@ var ts;
|
|
|
78382
78377
|
var type = getTypeOfSymbol(symbol);
|
|
78383
78378
|
if (strictNullChecks &&
|
|
78384
78379
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78385
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78380
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78386
78381
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78387
78382
|
}
|
|
78388
78383
|
}
|
|
@@ -78550,8 +78545,8 @@ var ts;
|
|
|
78550
78545
|
}
|
|
78551
78546
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78552
78547
|
var types = type.types;
|
|
78553
|
-
for (var _i = 0,
|
|
78554
|
-
var t =
|
|
78548
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78549
|
+
var t = types_20[_i];
|
|
78555
78550
|
if (maybeTypeOfKind(t, kind)) {
|
|
78556
78551
|
return true;
|
|
78557
78552
|
}
|
|
@@ -78778,7 +78773,7 @@ var ts;
|
|
|
78778
78773
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78779
78774
|
// undefined from the final type.
|
|
78780
78775
|
if (strictNullChecks &&
|
|
78781
|
-
!(
|
|
78776
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78782
78777
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78783
78778
|
}
|
|
78784
78779
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78791,6 +78786,10 @@ var ts;
|
|
|
78791
78786
|
if (target.kind === 221 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) {
|
|
78792
78787
|
checkBinaryExpression(target, checkMode);
|
|
78793
78788
|
target = target.left;
|
|
78789
|
+
// A default value is specified, so remove undefined from the final type.
|
|
78790
|
+
if (strictNullChecks) {
|
|
78791
|
+
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78792
|
+
}
|
|
78794
78793
|
}
|
|
78795
78794
|
if (target.kind === 205 /* ObjectLiteralExpression */) {
|
|
78796
78795
|
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
|
|
@@ -79178,7 +79177,7 @@ var ts;
|
|
|
79178
79177
|
case 56 /* BarBarToken */:
|
|
79179
79178
|
case 75 /* BarBarEqualsToken */: {
|
|
79180
79179
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79181
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79180
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79182
79181
|
leftType;
|
|
79183
79182
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79184
79183
|
checkAssignmentOperator(rightType);
|
|
@@ -81719,8 +81718,8 @@ var ts;
|
|
|
81719
81718
|
}
|
|
81720
81719
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81721
81720
|
var commonEntityName;
|
|
81722
|
-
for (var _i = 0,
|
|
81723
|
-
var typeNode =
|
|
81721
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81722
|
+
var typeNode = types_21[_i];
|
|
81724
81723
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81725
81724
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81726
81725
|
}
|
|
@@ -82586,7 +82585,7 @@ var ts;
|
|
|
82586
82585
|
// For a binding pattern, validate the initializer and exit
|
|
82587
82586
|
if (ts.isBindingPattern(node.name)) {
|
|
82588
82587
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82589
|
-
var needCheckWidenedType = node.name.elements.
|
|
82588
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82590
82589
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82591
82590
|
// Don't validate for-in initializer as it is already an error
|
|
82592
82591
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82739,7 +82738,7 @@ var ts;
|
|
|
82739
82738
|
return;
|
|
82740
82739
|
var type = checkTruthinessExpression(location);
|
|
82741
82740
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82742
|
-
if (
|
|
82741
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82743
82742
|
return;
|
|
82744
82743
|
// While it technically should be invalid for any known-truthy value
|
|
82745
82744
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84425,18 +84424,17 @@ var ts;
|
|
|
84425
84424
|
// but not by other kinds of members.
|
|
84426
84425
|
// Base class instance member variables and accessors can be overridden by
|
|
84427
84426
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84428
|
-
var _a, _b;
|
|
84427
|
+
var _a, _b, _c, _d;
|
|
84429
84428
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84430
84429
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84431
|
-
|
|
84432
|
-
var baseProperty = baseProperties_1[_i];
|
|
84430
|
+
var _loop_33 = function (baseProperty) {
|
|
84433
84431
|
var base = getTargetSymbol(baseProperty);
|
|
84434
84432
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84435
|
-
continue;
|
|
84433
|
+
return "continue";
|
|
84436
84434
|
}
|
|
84437
84435
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84438
84436
|
if (!baseSymbol) {
|
|
84439
|
-
continue;
|
|
84437
|
+
return "continue";
|
|
84440
84438
|
}
|
|
84441
84439
|
var derived = getTargetSymbol(baseSymbol);
|
|
84442
84440
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84454,14 +84452,14 @@ var ts;
|
|
|
84454
84452
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84455
84453
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84456
84454
|
// same name.)
|
|
84457
|
-
for (var
|
|
84458
|
-
var otherBaseType =
|
|
84455
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84456
|
+
var otherBaseType = _f[_e];
|
|
84459
84457
|
if (otherBaseType === baseType)
|
|
84460
84458
|
continue;
|
|
84461
84459
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84462
84460
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84463
84461
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84464
|
-
continue
|
|
84462
|
+
return "continue-basePropertyCheck";
|
|
84465
84463
|
}
|
|
84466
84464
|
}
|
|
84467
84465
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84476,20 +84474,19 @@ var ts;
|
|
|
84476
84474
|
// derived overrides base.
|
|
84477
84475
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84478
84476
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84479
|
-
|
|
84480
|
-
continue;
|
|
84477
|
+
return "continue";
|
|
84481
84478
|
}
|
|
84482
84479
|
var errorMessage = void 0;
|
|
84483
84480
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84484
84481
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84485
84482
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84486
84483
|
// property/accessor is overridden with property/accessor
|
|
84487
|
-
if (
|
|
84488
|
-
|
|
84484
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84485
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84486
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84487
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84489
84488
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84490
|
-
|
|
84491
|
-
// same when the derived property is from an assignment
|
|
84492
|
-
continue;
|
|
84489
|
+
return "continue";
|
|
84493
84490
|
}
|
|
84494
84491
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84495
84492
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84500,12 +84497,12 @@ var ts;
|
|
|
84500
84497
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84501
84498
|
}
|
|
84502
84499
|
else if (useDefineForClassFields) {
|
|
84503
|
-
var uninitialized = (
|
|
84500
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84504
84501
|
if (uninitialized
|
|
84505
84502
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84506
84503
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84507
84504
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84508
|
-
&& !((
|
|
84505
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84509
84506
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84510
84507
|
var propName = uninitialized.name;
|
|
84511
84508
|
if (uninitialized.exclamationToken
|
|
@@ -84518,13 +84515,11 @@ var ts;
|
|
|
84518
84515
|
}
|
|
84519
84516
|
}
|
|
84520
84517
|
}
|
|
84521
|
-
|
|
84522
|
-
continue;
|
|
84518
|
+
return "continue";
|
|
84523
84519
|
}
|
|
84524
84520
|
else if (isPrototypeProperty(base)) {
|
|
84525
84521
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84526
|
-
|
|
84527
|
-
continue;
|
|
84522
|
+
return "continue";
|
|
84528
84523
|
}
|
|
84529
84524
|
else {
|
|
84530
84525
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84539,9 +84534,20 @@ var ts;
|
|
|
84539
84534
|
}
|
|
84540
84535
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84541
84536
|
}
|
|
84537
|
+
};
|
|
84538
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84539
|
+
var baseProperty = baseProperties_1[_i];
|
|
84540
|
+
var state_10 = _loop_33(baseProperty);
|
|
84541
|
+
switch (state_10) {
|
|
84542
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84543
|
+
}
|
|
84542
84544
|
}
|
|
84543
84545
|
}
|
|
84544
|
-
function
|
|
84546
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84547
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84548
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84549
|
+
}
|
|
84550
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84545
84551
|
if (!ts.length(baseTypes)) {
|
|
84546
84552
|
return properties;
|
|
84547
84553
|
}
|
|
@@ -84610,7 +84616,7 @@ var ts;
|
|
|
84610
84616
|
var propName = member.name;
|
|
84611
84617
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84612
84618
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84613
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84619
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84614
84620
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84615
84621
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84616
84622
|
}
|
|
@@ -84635,7 +84641,7 @@ var ts;
|
|
|
84635
84641
|
ts.setParent(reference, staticBlock);
|
|
84636
84642
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84637
84643
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84638
|
-
if (!(
|
|
84644
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84639
84645
|
return true;
|
|
84640
84646
|
}
|
|
84641
84647
|
}
|
|
@@ -84650,7 +84656,7 @@ var ts;
|
|
|
84650
84656
|
ts.setParent(reference, constructor);
|
|
84651
84657
|
reference.flowNode = constructor.returnFlowNode;
|
|
84652
84658
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84653
|
-
return !(
|
|
84659
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84654
84660
|
}
|
|
84655
84661
|
function checkInterfaceDeclaration(node) {
|
|
84656
84662
|
// Grammar checking
|
|
@@ -92940,8 +92946,8 @@ var ts;
|
|
|
92940
92946
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
92941
92947
|
// so that aliases can be marked as referenced
|
|
92942
92948
|
var serializedUnion;
|
|
92943
|
-
for (var _i = 0,
|
|
92944
|
-
var typeNode =
|
|
92949
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
92950
|
+
var typeNode = types_22[_i];
|
|
92945
92951
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
92946
92952
|
typeNode = typeNode.type; // Skip parens if need be
|
|
92947
92953
|
}
|
|
@@ -113556,8 +113562,8 @@ var ts;
|
|
|
113556
113562
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113557
113563
|
writeLine();
|
|
113558
113564
|
}
|
|
113559
|
-
for (var _d = 0,
|
|
113560
|
-
var directive =
|
|
113565
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113566
|
+
var directive = types_23[_d];
|
|
113561
113567
|
var pos = writer.getTextPos();
|
|
113562
113568
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113563
113569
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -122325,7 +122331,7 @@ var ts;
|
|
|
122325
122331
|
});
|
|
122326
122332
|
// Sort by paths closest to importing file Name directory
|
|
122327
122333
|
var sortedPaths = [];
|
|
122328
|
-
var
|
|
122334
|
+
var _loop_34 = function (directory) {
|
|
122329
122335
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122330
122336
|
var pathsInDirectory;
|
|
122331
122337
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122349,9 +122355,9 @@ var ts;
|
|
|
122349
122355
|
};
|
|
122350
122356
|
var out_directory_1;
|
|
122351
122357
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122352
|
-
var
|
|
122358
|
+
var state_11 = _loop_34(directory);
|
|
122353
122359
|
directory = out_directory_1;
|
|
122354
|
-
if (
|
|
122360
|
+
if (state_11 === "break")
|
|
122355
122361
|
break;
|
|
122356
122362
|
}
|
|
122357
122363
|
if (allFileNames.size) {
|
|
@@ -144037,7 +144043,7 @@ var ts;
|
|
|
144037
144043
|
if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
|
|
144038
144044
|
return;
|
|
144039
144045
|
}
|
|
144040
|
-
if (ts.isTypeNode(node)) {
|
|
144046
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
|
|
144041
144047
|
return;
|
|
144042
144048
|
}
|
|
144043
144049
|
if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
|
|
@@ -147148,7 +147154,6 @@ var ts;
|
|
|
147148
147154
|
case 280 /* JsxOpeningElement */:
|
|
147149
147155
|
case 281 /* JsxClosingElement */:
|
|
147150
147156
|
case 279 /* JsxSelfClosingElement */:
|
|
147151
|
-
case 228 /* ExpressionWithTypeArguments */:
|
|
147152
147157
|
return false;
|
|
147153
147158
|
}
|
|
147154
147159
|
break;
|
|
@@ -147318,7 +147323,7 @@ var ts;
|
|
|
147318
147323
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
147319
147324
|
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
147320
147325
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
147321
|
-
if (tokenInfo.token.kind === 27 /* CommaToken */
|
|
147326
|
+
if (tokenInfo.token.kind === 27 /* CommaToken */) {
|
|
147322
147327
|
// consume the comma
|
|
147323
147328
|
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
|
147324
147329
|
tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
|
|
@@ -147722,6 +147727,12 @@ var ts;
|
|
|
147722
147727
|
case 169 /* MethodDeclaration */:
|
|
147723
147728
|
case 168 /* MethodSignature */:
|
|
147724
147729
|
case 214 /* ArrowFunction */:
|
|
147730
|
+
case 174 /* CallSignature */:
|
|
147731
|
+
case 175 /* ConstructSignature */:
|
|
147732
|
+
case 179 /* FunctionType */:
|
|
147733
|
+
case 180 /* ConstructorType */:
|
|
147734
|
+
case 172 /* GetAccessor */:
|
|
147735
|
+
case 173 /* SetAccessor */:
|
|
147725
147736
|
if (node.typeParameters === list) {
|
|
147726
147737
|
return 29 /* LessThanToken */;
|
|
147727
147738
|
}
|
|
@@ -147738,7 +147749,19 @@ var ts;
|
|
|
147738
147749
|
return 20 /* OpenParenToken */;
|
|
147739
147750
|
}
|
|
147740
147751
|
break;
|
|
147752
|
+
case 257 /* ClassDeclaration */:
|
|
147753
|
+
case 226 /* ClassExpression */:
|
|
147754
|
+
case 258 /* InterfaceDeclaration */:
|
|
147755
|
+
case 259 /* TypeAliasDeclaration */:
|
|
147756
|
+
if (node.typeParameters === list) {
|
|
147757
|
+
return 29 /* LessThanToken */;
|
|
147758
|
+
}
|
|
147759
|
+
break;
|
|
147741
147760
|
case 178 /* TypeReference */:
|
|
147761
|
+
case 210 /* TaggedTemplateExpression */:
|
|
147762
|
+
case 181 /* TypeQuery */:
|
|
147763
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
147764
|
+
case 200 /* ImportType */:
|
|
147742
147765
|
if (node.typeArguments === list) {
|
|
147743
147766
|
return 29 /* LessThanToken */;
|
|
147744
147767
|
}
|