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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220602";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9099,6 +9099,7 @@ var ts;
|
|
|
9099
9099
|
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."),
|
|
9100
9100
|
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."),
|
|
9101
9101
|
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."),
|
|
9102
|
+
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"),
|
|
9102
9103
|
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}'."),
|
|
9103
9104
|
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}'."),
|
|
9104
9105
|
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}'."),
|
|
@@ -44368,8 +44369,8 @@ var ts;
|
|
|
44368
44369
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44369
44370
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44370
44371
|
if (!pathAndExtension && packageInfo
|
|
44371
|
-
|
|
44372
|
-
&& packageInfo.packageJsonContent.
|
|
44372
|
+
// eslint-disable-next-line no-null/no-null
|
|
44373
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44373
44374
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44374
44375
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44375
44376
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -48034,7 +48035,10 @@ var ts;
|
|
|
48034
48035
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
48035
48036
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
48036
48037
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
48037
|
-
TypeFacts[TypeFacts["
|
|
48038
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
48039
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
48040
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
48041
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
48038
48042
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
48039
48043
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
48040
48044
|
// of that kind of type.
|
|
@@ -48076,14 +48080,16 @@ var ts;
|
|
|
48076
48080
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
48077
48081
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
48078
48082
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
48079
|
-
TypeFacts[TypeFacts["
|
|
48080
|
-
TypeFacts[TypeFacts["
|
|
48081
|
-
TypeFacts[TypeFacts["
|
|
48083
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
48084
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
48085
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
48086
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
48087
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
48088
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
48082
48089
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
48083
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
48084
48090
|
// Masks
|
|
48085
48091
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
48086
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
48092
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
48087
48093
|
})(TypeFacts || (TypeFacts = {}));
|
|
48088
48094
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
48089
48095
|
string: 1 /* TypeofEQString */,
|
|
@@ -50247,7 +50253,12 @@ var ts;
|
|
|
50247
50253
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50248
50254
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50249
50255
|
if (isPrimitiveTypeName(name)) {
|
|
50250
|
-
|
|
50256
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50257
|
+
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));
|
|
50258
|
+
}
|
|
50259
|
+
else {
|
|
50260
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50261
|
+
}
|
|
50251
50262
|
return true;
|
|
50252
50263
|
}
|
|
50253
50264
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50267,6 +50278,16 @@ var ts;
|
|
|
50267
50278
|
}
|
|
50268
50279
|
return false;
|
|
50269
50280
|
}
|
|
50281
|
+
function isExtendedByInterface(node) {
|
|
50282
|
+
var grandparent = node.parent.parent;
|
|
50283
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50284
|
+
if (grandparent && parentOfGrandparent) {
|
|
50285
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50286
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50287
|
+
return isExtending && isInterface;
|
|
50288
|
+
}
|
|
50289
|
+
return false;
|
|
50290
|
+
}
|
|
50270
50291
|
function maybeMappedType(node, symbol) {
|
|
50271
50292
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50272
50293
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -53107,7 +53128,7 @@ var ts;
|
|
|
53107
53128
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
53108
53129
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53109
53130
|
context.enclosingDeclaration = undefined;
|
|
53110
|
-
if (context.tracker.trackSymbol &&
|
|
53131
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
53111
53132
|
if (propertySymbol.declarations) {
|
|
53112
53133
|
var decl = ts.first(propertySymbol.declarations);
|
|
53113
53134
|
if (hasLateBindableName(decl)) {
|
|
@@ -54791,7 +54812,7 @@ var ts;
|
|
|
54791
54812
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54792
54813
|
: anyType;
|
|
54793
54814
|
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);
|
|
54794
|
-
var symbolProps =
|
|
54815
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54795
54816
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54796
54817
|
// `valueDeclaration` could be undefined if inherited from
|
|
54797
54818
|
// a union/intersection base type, but inherited properties
|
|
@@ -55929,7 +55950,7 @@ var ts;
|
|
|
55929
55950
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55930
55951
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55931
55952
|
// undefined from the final type.
|
|
55932
|
-
return strictNullChecks && !(
|
|
55953
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55933
55954
|
}
|
|
55934
55955
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55935
55956
|
}
|
|
@@ -59132,7 +59153,7 @@ var ts;
|
|
|
59132
59153
|
var objectType;
|
|
59133
59154
|
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
59134
59155
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
59135
|
-
!objectType
|
|
59156
|
+
!(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
59136
59157
|
}
|
|
59137
59158
|
/**
|
|
59138
59159
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -64424,7 +64445,7 @@ var ts;
|
|
|
64424
64445
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64425
64446
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64426
64447
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64427
|
-
(
|
|
64448
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64428
64449
|
var related = callbacks ?
|
|
64429
64450
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64430
64451
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67642,30 +67663,8 @@ var ts;
|
|
|
67642
67663
|
var value = _a.value;
|
|
67643
67664
|
return value.base10Value === "0";
|
|
67644
67665
|
}
|
|
67645
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67646
|
-
var result = 0;
|
|
67647
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67648
|
-
var t = types_14[_i];
|
|
67649
|
-
result |= getFalsyFlags(t);
|
|
67650
|
-
}
|
|
67651
|
-
return result;
|
|
67652
|
-
}
|
|
67653
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67654
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67655
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67656
|
-
function getFalsyFlags(type) {
|
|
67657
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67658
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67659
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67660
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67661
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67662
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67663
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67664
|
-
}
|
|
67665
67666
|
function removeDefinitelyFalsyTypes(type) {
|
|
67666
|
-
return
|
|
67667
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67668
|
-
type;
|
|
67667
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67669
67668
|
}
|
|
67670
67669
|
function extractDefinitelyFalsyTypes(type) {
|
|
67671
67670
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67708,14 +67707,7 @@ var ts;
|
|
|
67708
67707
|
getIntersectionType([type, emptyObjectType]);
|
|
67709
67708
|
}
|
|
67710
67709
|
function getNonNullableType(type) {
|
|
67711
|
-
|
|
67712
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67713
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67714
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67715
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67716
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67717
|
-
}
|
|
67718
|
-
return type;
|
|
67710
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67719
67711
|
}
|
|
67720
67712
|
function addOptionalTypeMarker(type) {
|
|
67721
67713
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68859,8 +68851,8 @@ var ts;
|
|
|
68859
68851
|
}
|
|
68860
68852
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68861
68853
|
var typeVariable;
|
|
68862
|
-
for (var _i = 0,
|
|
68863
|
-
var type =
|
|
68854
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68855
|
+
var type = types_14[_i];
|
|
68864
68856
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68865
68857
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68866
68858
|
return undefined;
|
|
@@ -69613,8 +69605,8 @@ var ts;
|
|
|
69613
69605
|
}
|
|
69614
69606
|
}
|
|
69615
69607
|
};
|
|
69616
|
-
for (var _i = 0,
|
|
69617
|
-
var type =
|
|
69608
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69609
|
+
var type = types_15[_i];
|
|
69618
69610
|
var state_9 = _loop_24(type);
|
|
69619
69611
|
if (typeof state_9 === "object")
|
|
69620
69612
|
return state_9.value;
|
|
@@ -69729,14 +69721,16 @@ var ts;
|
|
|
69729
69721
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69730
69722
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69731
69723
|
}
|
|
69732
|
-
function getTypeFacts(type
|
|
69733
|
-
if (
|
|
69724
|
+
function getTypeFacts(type) {
|
|
69725
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69726
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69727
|
+
}
|
|
69734
69728
|
var flags = type.flags;
|
|
69735
|
-
if (flags & 4 /* String */) {
|
|
69729
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69736
69730
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69737
69731
|
}
|
|
69738
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69739
|
-
var isEmpty = type.value === "";
|
|
69732
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69733
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69740
69734
|
return strictNullChecks ?
|
|
69741
69735
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69742
69736
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69768,20 +69762,20 @@ var ts;
|
|
|
69768
69762
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69769
69763
|
}
|
|
69770
69764
|
if (flags & 524288 /* Object */) {
|
|
69771
|
-
if (ignoreObjects) {
|
|
69772
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69773
|
-
}
|
|
69774
69765
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69775
|
-
strictNullChecks ?
|
|
69766
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69776
69767
|
isFunctionObjectType(type) ?
|
|
69777
69768
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69778
69769
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69779
69770
|
}
|
|
69780
|
-
if (flags &
|
|
69781
|
-
return 9830144 /*
|
|
69771
|
+
if (flags & 16384 /* Void */) {
|
|
69772
|
+
return 9830144 /* VoidFacts */;
|
|
69773
|
+
}
|
|
69774
|
+
if (flags & 32768 /* Undefined */) {
|
|
69775
|
+
return 26607360 /* UndefinedFacts */;
|
|
69782
69776
|
}
|
|
69783
69777
|
if (flags & 65536 /* Null */) {
|
|
69784
|
-
return
|
|
69778
|
+
return 42917664 /* NullFacts */;
|
|
69785
69779
|
}
|
|
69786
69780
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69787
69781
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69792,38 +69786,39 @@ var ts;
|
|
|
69792
69786
|
if (flags & 131072 /* Never */) {
|
|
69793
69787
|
return 0 /* None */;
|
|
69794
69788
|
}
|
|
69795
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69796
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69797
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69798
|
-
}
|
|
69799
69789
|
if (flags & 1048576 /* Union */) {
|
|
69800
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69790
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69801
69791
|
}
|
|
69802
69792
|
if (flags & 2097152 /* Intersection */) {
|
|
69803
|
-
|
|
69804
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69805
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69806
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69793
|
+
return getIntersectionTypeFacts(type);
|
|
69807
69794
|
}
|
|
69808
|
-
return
|
|
69795
|
+
return 83886079 /* UnknownFacts */;
|
|
69809
69796
|
}
|
|
69810
|
-
function getIntersectionTypeFacts(type
|
|
69797
|
+
function getIntersectionTypeFacts(type) {
|
|
69798
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69799
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69800
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69811
69801
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69812
69802
|
// and others are computed as `or`.
|
|
69813
69803
|
var oredFacts = 0 /* None */;
|
|
69814
|
-
var andedFacts =
|
|
69804
|
+
var andedFacts = 134217727 /* All */;
|
|
69815
69805
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69816
69806
|
var t = _a[_i];
|
|
69817
|
-
|
|
69818
|
-
|
|
69819
|
-
|
|
69807
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69808
|
+
var f = getTypeFacts(t);
|
|
69809
|
+
oredFacts |= f;
|
|
69810
|
+
andedFacts &= f;
|
|
69811
|
+
}
|
|
69820
69812
|
}
|
|
69821
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69813
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69822
69814
|
}
|
|
69823
69815
|
function getTypeWithFacts(type, include) {
|
|
69824
69816
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69825
69817
|
}
|
|
69826
|
-
function
|
|
69818
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69819
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69820
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69821
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69827
69822
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69828
69823
|
if (strictNullChecks) {
|
|
69829
69824
|
switch (facts) {
|
|
@@ -70089,8 +70084,8 @@ var ts;
|
|
|
70089
70084
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
70090
70085
|
var mappedTypes;
|
|
70091
70086
|
var changed = false;
|
|
70092
|
-
for (var _i = 0,
|
|
70093
|
-
var t =
|
|
70087
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
70088
|
+
var t = types_16[_i];
|
|
70094
70089
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
70095
70090
|
changed || (changed = t !== mapped);
|
|
70096
70091
|
if (mapped) {
|
|
@@ -70176,8 +70171,8 @@ var ts;
|
|
|
70176
70171
|
}
|
|
70177
70172
|
function isEvolvingArrayTypeList(types) {
|
|
70178
70173
|
var hasEvolvingArrayType = false;
|
|
70179
|
-
for (var _i = 0,
|
|
70180
|
-
var t =
|
|
70174
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
70175
|
+
var t = types_17[_i];
|
|
70181
70176
|
if (!(t.flags & 131072 /* Never */)) {
|
|
70182
70177
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
70183
70178
|
return false;
|
|
@@ -71000,10 +70995,10 @@ var ts;
|
|
|
71000
70995
|
}
|
|
71001
70996
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
71002
70997
|
if (isMatchingReference(reference, expr)) {
|
|
71003
|
-
return
|
|
70998
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
71004
70999
|
}
|
|
71005
71000
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
71006
|
-
type =
|
|
71001
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71007
71002
|
}
|
|
71008
71003
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71009
71004
|
if (access) {
|
|
@@ -71143,7 +71138,7 @@ var ts;
|
|
|
71143
71138
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
71144
71139
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
71145
71140
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
71146
|
-
return removeNullable ?
|
|
71141
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
71147
71142
|
}
|
|
71148
71143
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
71149
71144
|
if (type.flags & 1 /* Any */) {
|
|
@@ -71172,7 +71167,7 @@ var ts;
|
|
|
71172
71167
|
valueType.flags & 65536 /* Null */ ?
|
|
71173
71168
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
71174
71169
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
71175
|
-
return
|
|
71170
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
71176
71171
|
}
|
|
71177
71172
|
if (assumeTrue) {
|
|
71178
71173
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -71193,7 +71188,7 @@ var ts;
|
|
|
71193
71188
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
71194
71189
|
if (!isMatchingReference(reference, target)) {
|
|
71195
71190
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
71196
|
-
return
|
|
71191
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71197
71192
|
}
|
|
71198
71193
|
return type;
|
|
71199
71194
|
}
|
|
@@ -71397,7 +71392,7 @@ var ts;
|
|
|
71397
71392
|
var left = getReferenceCandidate(expr.left);
|
|
71398
71393
|
if (!isMatchingReference(reference, left)) {
|
|
71399
71394
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71400
|
-
return
|
|
71395
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71401
71396
|
}
|
|
71402
71397
|
return type;
|
|
71403
71398
|
}
|
|
@@ -71485,7 +71480,7 @@ var ts;
|
|
|
71485
71480
|
}
|
|
71486
71481
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71487
71482
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71488
|
-
type =
|
|
71483
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71489
71484
|
}
|
|
71490
71485
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71491
71486
|
if (access) {
|
|
@@ -71542,7 +71537,7 @@ var ts;
|
|
|
71542
71537
|
}
|
|
71543
71538
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71544
71539
|
if (isMatchingReference(reference, expr)) {
|
|
71545
|
-
return
|
|
71540
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71546
71541
|
}
|
|
71547
71542
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71548
71543
|
if (access) {
|
|
@@ -71628,8 +71623,8 @@ var ts;
|
|
|
71628
71623
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71629
71624
|
declaration.kind === 164 /* Parameter */ &&
|
|
71630
71625
|
declaration.initializer &&
|
|
71631
|
-
|
|
71632
|
-
!(
|
|
71626
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71627
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71633
71628
|
popTypeResolution();
|
|
71634
71629
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71635
71630
|
}
|
|
@@ -71957,7 +71952,7 @@ var ts;
|
|
|
71957
71952
|
return convertAutoToAny(flowType);
|
|
71958
71953
|
}
|
|
71959
71954
|
}
|
|
71960
|
-
else if (!assumeInitialized && !(
|
|
71955
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71961
71956
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71962
71957
|
// Return the declared type to reduce follow-on errors
|
|
71963
71958
|
return type;
|
|
@@ -73486,8 +73481,8 @@ var ts;
|
|
|
73486
73481
|
}
|
|
73487
73482
|
var signatureList;
|
|
73488
73483
|
var types = type.types;
|
|
73489
|
-
for (var _i = 0,
|
|
73490
|
-
var current =
|
|
73484
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73485
|
+
var current = types_18[_i];
|
|
73491
73486
|
var signature = getContextualCallSignature(current, node);
|
|
73492
73487
|
if (signature) {
|
|
73493
73488
|
if (!signatureList) {
|
|
@@ -74649,19 +74644,19 @@ var ts;
|
|
|
74649
74644
|
return checkNonNullType(checkExpression(node), node);
|
|
74650
74645
|
}
|
|
74651
74646
|
function isNullableType(type) {
|
|
74652
|
-
return !!((
|
|
74647
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74653
74648
|
}
|
|
74654
74649
|
function getNonNullableTypeIfNeeded(type) {
|
|
74655
74650
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74656
74651
|
}
|
|
74657
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74658
|
-
error(node,
|
|
74652
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74653
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74659
74654
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74660
74655
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74661
74656
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74662
74657
|
}
|
|
74663
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74664
|
-
error(node,
|
|
74658
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74659
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74665
74660
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74666
74661
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74667
74662
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74671,9 +74666,9 @@ var ts;
|
|
|
74671
74666
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74672
74667
|
return errorType;
|
|
74673
74668
|
}
|
|
74674
|
-
var
|
|
74675
|
-
if (
|
|
74676
|
-
reportError(node,
|
|
74669
|
+
var facts = getTypeFacts(type);
|
|
74670
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74671
|
+
reportError(node, facts);
|
|
74677
74672
|
var t = getNonNullableType(type);
|
|
74678
74673
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74679
74674
|
}
|
|
@@ -74968,7 +74963,7 @@ var ts;
|
|
|
74968
74963
|
assumeUninitialized = true;
|
|
74969
74964
|
}
|
|
74970
74965
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74971
|
-
if (assumeUninitialized && !(
|
|
74966
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74972
74967
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74973
74968
|
// Return the declared type to reduce follow-on errors
|
|
74974
74969
|
return propType;
|
|
@@ -76884,8 +76879,8 @@ var ts;
|
|
|
76884
76879
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76885
76880
|
var types = apparentType.types;
|
|
76886
76881
|
var hasSignatures = false;
|
|
76887
|
-
for (var _i = 0,
|
|
76888
|
-
var constituent =
|
|
76882
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76883
|
+
var constituent = types_19[_i];
|
|
76889
76884
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76890
76885
|
if (signatures.length !== 0) {
|
|
76891
76886
|
hasSignatures = true;
|
|
@@ -78576,7 +78571,7 @@ var ts;
|
|
|
78576
78571
|
var type = getTypeOfSymbol(symbol);
|
|
78577
78572
|
if (strictNullChecks &&
|
|
78578
78573
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78579
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78574
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78580
78575
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78581
78576
|
}
|
|
78582
78577
|
}
|
|
@@ -78744,8 +78739,8 @@ var ts;
|
|
|
78744
78739
|
}
|
|
78745
78740
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78746
78741
|
var types = type.types;
|
|
78747
|
-
for (var _i = 0,
|
|
78748
|
-
var t =
|
|
78742
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78743
|
+
var t = types_20[_i];
|
|
78749
78744
|
if (maybeTypeOfKind(t, kind)) {
|
|
78750
78745
|
return true;
|
|
78751
78746
|
}
|
|
@@ -78972,7 +78967,7 @@ var ts;
|
|
|
78972
78967
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78973
78968
|
// undefined from the final type.
|
|
78974
78969
|
if (strictNullChecks &&
|
|
78975
|
-
!(
|
|
78970
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78976
78971
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78977
78972
|
}
|
|
78978
78973
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78985,6 +78980,10 @@ var ts;
|
|
|
78985
78980
|
if (target.kind === 221 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) {
|
|
78986
78981
|
checkBinaryExpression(target, checkMode);
|
|
78987
78982
|
target = target.left;
|
|
78983
|
+
// A default value is specified, so remove undefined from the final type.
|
|
78984
|
+
if (strictNullChecks) {
|
|
78985
|
+
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78986
|
+
}
|
|
78988
78987
|
}
|
|
78989
78988
|
if (target.kind === 205 /* ObjectLiteralExpression */) {
|
|
78990
78989
|
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
|
|
@@ -79372,7 +79371,7 @@ var ts;
|
|
|
79372
79371
|
case 56 /* BarBarToken */:
|
|
79373
79372
|
case 75 /* BarBarEqualsToken */: {
|
|
79374
79373
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79375
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79374
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79376
79375
|
leftType;
|
|
79377
79376
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79378
79377
|
checkAssignmentOperator(rightType);
|
|
@@ -81913,8 +81912,8 @@ var ts;
|
|
|
81913
81912
|
}
|
|
81914
81913
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81915
81914
|
var commonEntityName;
|
|
81916
|
-
for (var _i = 0,
|
|
81917
|
-
var typeNode =
|
|
81915
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81916
|
+
var typeNode = types_21[_i];
|
|
81918
81917
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81919
81918
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81920
81919
|
}
|
|
@@ -82780,7 +82779,7 @@ var ts;
|
|
|
82780
82779
|
// For a binding pattern, validate the initializer and exit
|
|
82781
82780
|
if (ts.isBindingPattern(node.name)) {
|
|
82782
82781
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82783
|
-
var needCheckWidenedType = node.name.elements.
|
|
82782
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82784
82783
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82785
82784
|
// Don't validate for-in initializer as it is already an error
|
|
82786
82785
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82933,7 +82932,7 @@ var ts;
|
|
|
82933
82932
|
return;
|
|
82934
82933
|
var type = checkTruthinessExpression(location);
|
|
82935
82934
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82936
|
-
if (
|
|
82935
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82937
82936
|
return;
|
|
82938
82937
|
// While it technically should be invalid for any known-truthy value
|
|
82939
82938
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84619,18 +84618,17 @@ var ts;
|
|
|
84619
84618
|
// but not by other kinds of members.
|
|
84620
84619
|
// Base class instance member variables and accessors can be overridden by
|
|
84621
84620
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84622
|
-
var _a, _b;
|
|
84621
|
+
var _a, _b, _c, _d;
|
|
84623
84622
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84624
84623
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84625
|
-
|
|
84626
|
-
var baseProperty = baseProperties_1[_i];
|
|
84624
|
+
var _loop_33 = function (baseProperty) {
|
|
84627
84625
|
var base = getTargetSymbol(baseProperty);
|
|
84628
84626
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84629
|
-
continue;
|
|
84627
|
+
return "continue";
|
|
84630
84628
|
}
|
|
84631
84629
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84632
84630
|
if (!baseSymbol) {
|
|
84633
|
-
continue;
|
|
84631
|
+
return "continue";
|
|
84634
84632
|
}
|
|
84635
84633
|
var derived = getTargetSymbol(baseSymbol);
|
|
84636
84634
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84648,14 +84646,14 @@ var ts;
|
|
|
84648
84646
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84649
84647
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84650
84648
|
// same name.)
|
|
84651
|
-
for (var
|
|
84652
|
-
var otherBaseType =
|
|
84649
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84650
|
+
var otherBaseType = _f[_e];
|
|
84653
84651
|
if (otherBaseType === baseType)
|
|
84654
84652
|
continue;
|
|
84655
84653
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84656
84654
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84657
84655
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84658
|
-
continue
|
|
84656
|
+
return "continue-basePropertyCheck";
|
|
84659
84657
|
}
|
|
84660
84658
|
}
|
|
84661
84659
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84670,20 +84668,19 @@ var ts;
|
|
|
84670
84668
|
// derived overrides base.
|
|
84671
84669
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84672
84670
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84673
|
-
|
|
84674
|
-
continue;
|
|
84671
|
+
return "continue";
|
|
84675
84672
|
}
|
|
84676
84673
|
var errorMessage = void 0;
|
|
84677
84674
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84678
84675
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84679
84676
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84680
84677
|
// property/accessor is overridden with property/accessor
|
|
84681
|
-
if (
|
|
84682
|
-
|
|
84678
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84679
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84680
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84681
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84683
84682
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84684
|
-
|
|
84685
|
-
// same when the derived property is from an assignment
|
|
84686
|
-
continue;
|
|
84683
|
+
return "continue";
|
|
84687
84684
|
}
|
|
84688
84685
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84689
84686
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84694,12 +84691,12 @@ var ts;
|
|
|
84694
84691
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84695
84692
|
}
|
|
84696
84693
|
else if (useDefineForClassFields) {
|
|
84697
|
-
var uninitialized = (
|
|
84694
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84698
84695
|
if (uninitialized
|
|
84699
84696
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84700
84697
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84701
84698
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84702
|
-
&& !((
|
|
84699
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84703
84700
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84704
84701
|
var propName = uninitialized.name;
|
|
84705
84702
|
if (uninitialized.exclamationToken
|
|
@@ -84712,13 +84709,11 @@ var ts;
|
|
|
84712
84709
|
}
|
|
84713
84710
|
}
|
|
84714
84711
|
}
|
|
84715
|
-
|
|
84716
|
-
continue;
|
|
84712
|
+
return "continue";
|
|
84717
84713
|
}
|
|
84718
84714
|
else if (isPrototypeProperty(base)) {
|
|
84719
84715
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84720
|
-
|
|
84721
|
-
continue;
|
|
84716
|
+
return "continue";
|
|
84722
84717
|
}
|
|
84723
84718
|
else {
|
|
84724
84719
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84733,9 +84728,20 @@ var ts;
|
|
|
84733
84728
|
}
|
|
84734
84729
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84735
84730
|
}
|
|
84731
|
+
};
|
|
84732
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84733
|
+
var baseProperty = baseProperties_1[_i];
|
|
84734
|
+
var state_10 = _loop_33(baseProperty);
|
|
84735
|
+
switch (state_10) {
|
|
84736
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84737
|
+
}
|
|
84736
84738
|
}
|
|
84737
84739
|
}
|
|
84738
|
-
function
|
|
84740
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84741
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84742
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84743
|
+
}
|
|
84744
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84739
84745
|
if (!ts.length(baseTypes)) {
|
|
84740
84746
|
return properties;
|
|
84741
84747
|
}
|
|
@@ -84804,7 +84810,7 @@ var ts;
|
|
|
84804
84810
|
var propName = member.name;
|
|
84805
84811
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84806
84812
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84807
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84813
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84808
84814
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84809
84815
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84810
84816
|
}
|
|
@@ -84829,7 +84835,7 @@ var ts;
|
|
|
84829
84835
|
ts.setParent(reference, staticBlock);
|
|
84830
84836
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84831
84837
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84832
|
-
if (!(
|
|
84838
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84833
84839
|
return true;
|
|
84834
84840
|
}
|
|
84835
84841
|
}
|
|
@@ -84844,7 +84850,7 @@ var ts;
|
|
|
84844
84850
|
ts.setParent(reference, constructor);
|
|
84845
84851
|
reference.flowNode = constructor.returnFlowNode;
|
|
84846
84852
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84847
|
-
return !(
|
|
84853
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84848
84854
|
}
|
|
84849
84855
|
function checkInterfaceDeclaration(node) {
|
|
84850
84856
|
// Grammar checking
|
|
@@ -93134,8 +93140,8 @@ var ts;
|
|
|
93134
93140
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
93135
93141
|
// so that aliases can be marked as referenced
|
|
93136
93142
|
var serializedUnion;
|
|
93137
|
-
for (var _i = 0,
|
|
93138
|
-
var typeNode =
|
|
93143
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
93144
|
+
var typeNode = types_22[_i];
|
|
93139
93145
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
93140
93146
|
typeNode = typeNode.type; // Skip parens if need be
|
|
93141
93147
|
}
|
|
@@ -113750,8 +113756,8 @@ var ts;
|
|
|
113750
113756
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113751
113757
|
writeLine();
|
|
113752
113758
|
}
|
|
113753
|
-
for (var _d = 0,
|
|
113754
|
-
var directive =
|
|
113759
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113760
|
+
var directive = types_23[_d];
|
|
113755
113761
|
var pos = writer.getTextPos();
|
|
113756
113762
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113757
113763
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -122519,7 +122525,7 @@ var ts;
|
|
|
122519
122525
|
});
|
|
122520
122526
|
// Sort by paths closest to importing file Name directory
|
|
122521
122527
|
var sortedPaths = [];
|
|
122522
|
-
var
|
|
122528
|
+
var _loop_34 = function (directory) {
|
|
122523
122529
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122524
122530
|
var pathsInDirectory;
|
|
122525
122531
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122543,9 +122549,9 @@ var ts;
|
|
|
122543
122549
|
};
|
|
122544
122550
|
var out_directory_1;
|
|
122545
122551
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122546
|
-
var
|
|
122552
|
+
var state_11 = _loop_34(directory);
|
|
122547
122553
|
directory = out_directory_1;
|
|
122548
|
-
if (
|
|
122554
|
+
if (state_11 === "break")
|
|
122549
122555
|
break;
|
|
122550
122556
|
}
|
|
122551
122557
|
if (allFileNames.size) {
|
|
@@ -144648,7 +144654,7 @@ var ts;
|
|
|
144648
144654
|
if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
|
|
144649
144655
|
return;
|
|
144650
144656
|
}
|
|
144651
|
-
if (ts.isTypeNode(node)) {
|
|
144657
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
|
|
144652
144658
|
return;
|
|
144653
144659
|
}
|
|
144654
144660
|
if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
|
|
@@ -147759,7 +147765,6 @@ var ts;
|
|
|
147759
147765
|
case 280 /* JsxOpeningElement */:
|
|
147760
147766
|
case 281 /* JsxClosingElement */:
|
|
147761
147767
|
case 279 /* JsxSelfClosingElement */:
|
|
147762
|
-
case 228 /* ExpressionWithTypeArguments */:
|
|
147763
147768
|
return false;
|
|
147764
147769
|
}
|
|
147765
147770
|
break;
|
|
@@ -147929,7 +147934,7 @@ var ts;
|
|
|
147929
147934
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
147930
147935
|
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
147931
147936
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
147932
|
-
if (tokenInfo.token.kind === 27 /* CommaToken */
|
|
147937
|
+
if (tokenInfo.token.kind === 27 /* CommaToken */) {
|
|
147933
147938
|
// consume the comma
|
|
147934
147939
|
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
|
147935
147940
|
tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
|
|
@@ -148333,6 +148338,12 @@ var ts;
|
|
|
148333
148338
|
case 169 /* MethodDeclaration */:
|
|
148334
148339
|
case 168 /* MethodSignature */:
|
|
148335
148340
|
case 214 /* ArrowFunction */:
|
|
148341
|
+
case 174 /* CallSignature */:
|
|
148342
|
+
case 175 /* ConstructSignature */:
|
|
148343
|
+
case 179 /* FunctionType */:
|
|
148344
|
+
case 180 /* ConstructorType */:
|
|
148345
|
+
case 172 /* GetAccessor */:
|
|
148346
|
+
case 173 /* SetAccessor */:
|
|
148336
148347
|
if (node.typeParameters === list) {
|
|
148337
148348
|
return 29 /* LessThanToken */;
|
|
148338
148349
|
}
|
|
@@ -148349,7 +148360,19 @@ var ts;
|
|
|
148349
148360
|
return 20 /* OpenParenToken */;
|
|
148350
148361
|
}
|
|
148351
148362
|
break;
|
|
148363
|
+
case 257 /* ClassDeclaration */:
|
|
148364
|
+
case 226 /* ClassExpression */:
|
|
148365
|
+
case 258 /* InterfaceDeclaration */:
|
|
148366
|
+
case 259 /* TypeAliasDeclaration */:
|
|
148367
|
+
if (node.typeParameters === list) {
|
|
148368
|
+
return 29 /* LessThanToken */;
|
|
148369
|
+
}
|
|
148370
|
+
break;
|
|
148352
148371
|
case 178 /* TypeReference */:
|
|
148372
|
+
case 210 /* TaggedTemplateExpression */:
|
|
148373
|
+
case 181 /* TypeQuery */:
|
|
148374
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
148375
|
+
case 200 /* ImportType */:
|
|
148353
148376
|
if (node.typeArguments === list) {
|
|
148354
148377
|
return 29 /* LessThanToken */;
|
|
148355
148378
|
}
|