typescript 4.6.0-dev.20211213 → 4.6.0-dev.20211218
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/lib.es2020.intl.d.ts +1 -1
- package/lib/tsc.js +45 -33
- package/lib/tsserver.js +55 -45
- package/lib/tsserverlibrary.js +55 -45
- package/lib/typescript.js +55 -45
- package/lib/typescriptServices.js +55 -45
- package/lib/typingsInstaller.js +52 -36
- package/package.json +1 -1
|
@@ -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.20211218";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -19910,7 +19910,7 @@ var ts;
|
|
|
19910
19910
|
}
|
|
19911
19911
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
19912
19912
|
function getUseDefineForClassFields(compilerOptions) {
|
|
19913
|
-
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions)
|
|
19913
|
+
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
|
|
19914
19914
|
}
|
|
19915
19915
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
19916
19916
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -33725,7 +33725,7 @@ var ts;
|
|
|
33725
33725
|
return true;
|
|
33726
33726
|
}
|
|
33727
33727
|
}
|
|
33728
|
-
else if (third === 27 /* CommaToken */) {
|
|
33728
|
+
else if (third === 27 /* CommaToken */ || third === 63 /* EqualsToken */) {
|
|
33729
33729
|
return true;
|
|
33730
33730
|
}
|
|
33731
33731
|
return false;
|
|
@@ -55591,7 +55591,8 @@ var ts;
|
|
|
55591
55591
|
return false;
|
|
55592
55592
|
}
|
|
55593
55593
|
function getBaseTypeNodeOfClass(type) {
|
|
55594
|
-
|
|
55594
|
+
var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
|
|
55595
|
+
return decl && ts.getEffectiveBaseTypeNode(decl);
|
|
55595
55596
|
}
|
|
55596
55597
|
function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
55597
55598
|
var typeArgCount = ts.length(typeArgumentNodes);
|
|
@@ -55613,8 +55614,8 @@ var ts;
|
|
|
55613
55614
|
*/
|
|
55614
55615
|
function getBaseConstructorTypeOfClass(type) {
|
|
55615
55616
|
if (!type.resolvedBaseConstructorType) {
|
|
55616
|
-
var decl = type.symbol
|
|
55617
|
-
var extended = ts.getEffectiveBaseTypeNode(decl);
|
|
55617
|
+
var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
|
|
55618
|
+
var extended = decl && ts.getEffectiveBaseTypeNode(decl);
|
|
55618
55619
|
var baseTypeNode = getBaseTypeNodeOfClass(type);
|
|
55619
55620
|
if (!baseTypeNode) {
|
|
55620
55621
|
return type.resolvedBaseConstructorType = undefinedType;
|
|
@@ -57619,13 +57620,23 @@ var ts;
|
|
|
57619
57620
|
}
|
|
57620
57621
|
return type;
|
|
57621
57622
|
}
|
|
57623
|
+
function isMappedTypeGenericIndexedAccess(type) {
|
|
57624
|
+
return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
|
|
57625
|
+
!isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
|
|
57626
|
+
}
|
|
57622
57627
|
/**
|
|
57623
57628
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
57624
57629
|
* boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
|
|
57625
57630
|
* type itself.
|
|
57626
57631
|
*/
|
|
57627
57632
|
function getApparentType(type) {
|
|
57628
|
-
|
|
57633
|
+
// We obtain the base constraint for all instantiable types, except indexed access types of the form
|
|
57634
|
+
// { [P in K]: E }[X], where K is non-generic and X is generic. For those types, we instead substitute an
|
|
57635
|
+
// instantiation of E where P is replaced with X. We do this because getBaseConstraintOfType directly
|
|
57636
|
+
// lowers to an instantiation where X's constraint is substituted for X, which isn't always desirable.
|
|
57637
|
+
var t = !(type.flags & 465829888 /* Instantiable */) ? type :
|
|
57638
|
+
isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
|
|
57639
|
+
getBaseConstraintOfType(type) || unknownType;
|
|
57629
57640
|
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
|
|
57630
57641
|
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
|
|
57631
57642
|
t.flags & 402653316 /* StringLike */ ? globalStringType :
|
|
@@ -58241,6 +58252,8 @@ var ts;
|
|
|
58241
58252
|
case 205 /* PropertyAccessExpression */:
|
|
58242
58253
|
case 206 /* ElementAccessExpression */:
|
|
58243
58254
|
return traverse(node.expression);
|
|
58255
|
+
case 294 /* PropertyAssignment */:
|
|
58256
|
+
return traverse(node.initializer);
|
|
58244
58257
|
default:
|
|
58245
58258
|
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
|
|
58246
58259
|
}
|
|
@@ -65896,7 +65909,7 @@ var ts;
|
|
|
65896
65909
|
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
65897
65910
|
// no flags for all other types (including non-falsy literal types).
|
|
65898
65911
|
function getFalsyFlags(type) {
|
|
65899
|
-
return type.flags &
|
|
65912
|
+
return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
|
|
65900
65913
|
type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
65901
65914
|
type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
65902
65915
|
type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
|
|
@@ -66810,12 +66823,14 @@ var ts;
|
|
|
66810
66823
|
// not contain anyFunctionType when we come back to this argument for its second round
|
|
66811
66824
|
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
|
|
66812
66825
|
// when constructing types from type parameters that had no inference candidates).
|
|
66813
|
-
if (
|
|
66814
|
-
(priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
66826
|
+
if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
66815
66827
|
return;
|
|
66816
66828
|
}
|
|
66817
66829
|
var inference = getInferenceInfoForType(target);
|
|
66818
66830
|
if (inference) {
|
|
66831
|
+
if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */) {
|
|
66832
|
+
return;
|
|
66833
|
+
}
|
|
66819
66834
|
if (!inference.isFixed) {
|
|
66820
66835
|
if (inference.priority === undefined || priority < inference.priority) {
|
|
66821
66836
|
inference.candidates = undefined;
|
|
@@ -66846,21 +66861,19 @@ var ts;
|
|
|
66846
66861
|
inferencePriority = Math.min(inferencePriority, priority);
|
|
66847
66862
|
return;
|
|
66848
66863
|
}
|
|
66849
|
-
|
|
66850
|
-
|
|
66851
|
-
|
|
66852
|
-
|
|
66853
|
-
|
|
66854
|
-
|
|
66855
|
-
|
|
66856
|
-
|
|
66857
|
-
|
|
66858
|
-
|
|
66859
|
-
|
|
66860
|
-
|
|
66861
|
-
|
|
66862
|
-
invokeOnce(source, simplified_1, inferFromTypes);
|
|
66863
|
-
}
|
|
66864
|
+
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
|
|
66865
|
+
var simplified = getSimplifiedType(target, /*writing*/ false);
|
|
66866
|
+
if (simplified !== target) {
|
|
66867
|
+
inferFromTypes(source, simplified);
|
|
66868
|
+
}
|
|
66869
|
+
else if (target.flags & 8388608 /* IndexedAccess */) {
|
|
66870
|
+
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
|
|
66871
|
+
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
|
|
66872
|
+
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
|
|
66873
|
+
if (indexType.flags & 465829888 /* Instantiable */) {
|
|
66874
|
+
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
|
|
66875
|
+
if (simplified_1 && simplified_1 !== target) {
|
|
66876
|
+
inferFromTypes(source, simplified_1);
|
|
66864
66877
|
}
|
|
66865
66878
|
}
|
|
66866
66879
|
}
|
|
@@ -69730,7 +69743,7 @@ var ts;
|
|
|
69730
69743
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
69731
69744
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
69732
69745
|
(isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
|
|
69733
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69746
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69734
69747
|
}
|
|
69735
69748
|
function isExportOrExportExpression(location) {
|
|
69736
69749
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -72701,11 +72714,14 @@ var ts;
|
|
|
72701
72714
|
if (!ts.getContainingClass(privId)) {
|
|
72702
72715
|
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
72703
72716
|
}
|
|
72704
|
-
if (!ts.
|
|
72705
|
-
|
|
72706
|
-
|
|
72707
|
-
|
|
72708
|
-
|
|
72717
|
+
if (!ts.isForInStatement(privId.parent)) {
|
|
72718
|
+
if (!ts.isExpressionNode(privId)) {
|
|
72719
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
|
|
72720
|
+
}
|
|
72721
|
+
var isInOperation = ts.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101 /* InKeyword */;
|
|
72722
|
+
if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
|
|
72723
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
|
|
72724
|
+
}
|
|
72709
72725
|
}
|
|
72710
72726
|
return false;
|
|
72711
72727
|
}
|
|
@@ -82719,7 +82735,7 @@ var ts;
|
|
|
82719
82735
|
if (memberSymbol) {
|
|
82720
82736
|
var declaration = memberSymbol.valueDeclaration;
|
|
82721
82737
|
if (declaration !== member) {
|
|
82722
|
-
if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member)) {
|
|
82738
|
+
if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && ts.isEnumDeclaration(declaration.parent)) {
|
|
82723
82739
|
return getEnumMemberValue(declaration);
|
|
82724
82740
|
}
|
|
82725
82741
|
error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
@@ -86092,7 +86108,7 @@ var ts;
|
|
|
86092
86108
|
if (prop.kind === 295 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
|
|
86093
86109
|
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
|
|
86094
86110
|
// outside of destructuring it is a syntax error
|
|
86095
|
-
|
|
86111
|
+
grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
|
|
86096
86112
|
}
|
|
86097
86113
|
if (name.kind === 80 /* PrivateIdentifier */) {
|
|
86098
86114
|
grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -92056,7 +92072,7 @@ var ts;
|
|
|
92056
92072
|
var compilerOptions = context.getCompilerOptions();
|
|
92057
92073
|
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
92058
92074
|
var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
|
|
92059
|
-
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion <
|
|
92075
|
+
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ES2022 */;
|
|
92060
92076
|
// We don't need to transform `super` property access when targeting ES5, ES3 because
|
|
92061
92077
|
// the es2015 transformation handles those.
|
|
92062
92078
|
var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 /* ES2021 */ || !useDefineForClassFields) && languageVersion >= 2 /* ES2015 */;
|
|
@@ -92086,7 +92102,7 @@ var ts;
|
|
|
92086
92102
|
function transformSourceFile(node) {
|
|
92087
92103
|
var options = context.getCompilerOptions();
|
|
92088
92104
|
if (node.isDeclarationFile
|
|
92089
|
-
|| useDefineForClassFields && ts.getEmitScriptTarget(options)
|
|
92105
|
+
|| useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ES2022 */) {
|
|
92090
92106
|
return node;
|
|
92091
92107
|
}
|
|
92092
92108
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -92843,7 +92859,7 @@ var ts;
|
|
|
92843
92859
|
if (useDefineForClassFields) {
|
|
92844
92860
|
// If we are using define semantics and targeting ESNext or higher,
|
|
92845
92861
|
// then we don't need to transform any class properties.
|
|
92846
|
-
return languageVersion <
|
|
92862
|
+
return languageVersion < 9 /* ES2022 */;
|
|
92847
92863
|
}
|
|
92848
92864
|
return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
|
|
92849
92865
|
}
|
|
@@ -123692,13 +123708,6 @@ var ts;
|
|
|
123692
123708
|
|| ts.isImportSpecifier(parent)
|
|
123693
123709
|
|| ts.isImportClause(parent)
|
|
123694
123710
|
|| ts.isImportEqualsDeclaration(parent) && node === parent.name) {
|
|
123695
|
-
var decl = parent;
|
|
123696
|
-
while (decl) {
|
|
123697
|
-
if (ts.isImportEqualsDeclaration(decl) || ts.isImportClause(decl) || ts.isExportDeclaration(decl)) {
|
|
123698
|
-
return decl.isTypeOnly ? 2 /* Type */ : 7 /* All */;
|
|
123699
|
-
}
|
|
123700
|
-
decl = decl.parent;
|
|
123701
|
-
}
|
|
123702
123711
|
return 7 /* All */;
|
|
123703
123712
|
}
|
|
123704
123713
|
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
|
|
@@ -157683,11 +157692,12 @@ var ts;
|
|
|
157683
157692
|
var result = [];
|
|
157684
157693
|
return visitor(selection) ? undefined : result;
|
|
157685
157694
|
function visitor(node) {
|
|
157695
|
+
var _a;
|
|
157686
157696
|
if (ts.isTypeReferenceNode(node)) {
|
|
157687
157697
|
if (ts.isIdentifier(node.typeName)) {
|
|
157688
157698
|
var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
|
|
157689
|
-
|
|
157690
|
-
|
|
157699
|
+
var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0], ts.isTypeParameterDeclaration);
|
|
157700
|
+
if (declaration) {
|
|
157691
157701
|
if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
|
|
157692
157702
|
ts.pushIfUnique(result, declaration);
|
|
157693
157703
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211218";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -19705,7 +19705,7 @@ var ts;
|
|
|
19705
19705
|
}
|
|
19706
19706
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
19707
19707
|
function getUseDefineForClassFields(compilerOptions) {
|
|
19708
|
-
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions)
|
|
19708
|
+
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
|
|
19709
19709
|
}
|
|
19710
19710
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
19711
19711
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -33520,7 +33520,7 @@ var ts;
|
|
|
33520
33520
|
return true;
|
|
33521
33521
|
}
|
|
33522
33522
|
}
|
|
33523
|
-
else if (third === 27 /* CommaToken */) {
|
|
33523
|
+
else if (third === 27 /* CommaToken */ || third === 63 /* EqualsToken */) {
|
|
33524
33524
|
return true;
|
|
33525
33525
|
}
|
|
33526
33526
|
return false;
|
|
@@ -55386,7 +55386,8 @@ var ts;
|
|
|
55386
55386
|
return false;
|
|
55387
55387
|
}
|
|
55388
55388
|
function getBaseTypeNodeOfClass(type) {
|
|
55389
|
-
|
|
55389
|
+
var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
|
|
55390
|
+
return decl && ts.getEffectiveBaseTypeNode(decl);
|
|
55390
55391
|
}
|
|
55391
55392
|
function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
55392
55393
|
var typeArgCount = ts.length(typeArgumentNodes);
|
|
@@ -55408,8 +55409,8 @@ var ts;
|
|
|
55408
55409
|
*/
|
|
55409
55410
|
function getBaseConstructorTypeOfClass(type) {
|
|
55410
55411
|
if (!type.resolvedBaseConstructorType) {
|
|
55411
|
-
var decl = type.symbol
|
|
55412
|
-
var extended = ts.getEffectiveBaseTypeNode(decl);
|
|
55412
|
+
var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
|
|
55413
|
+
var extended = decl && ts.getEffectiveBaseTypeNode(decl);
|
|
55413
55414
|
var baseTypeNode = getBaseTypeNodeOfClass(type);
|
|
55414
55415
|
if (!baseTypeNode) {
|
|
55415
55416
|
return type.resolvedBaseConstructorType = undefinedType;
|
|
@@ -57414,13 +57415,23 @@ var ts;
|
|
|
57414
57415
|
}
|
|
57415
57416
|
return type;
|
|
57416
57417
|
}
|
|
57418
|
+
function isMappedTypeGenericIndexedAccess(type) {
|
|
57419
|
+
return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
|
|
57420
|
+
!isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
|
|
57421
|
+
}
|
|
57417
57422
|
/**
|
|
57418
57423
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
57419
57424
|
* boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
|
|
57420
57425
|
* type itself.
|
|
57421
57426
|
*/
|
|
57422
57427
|
function getApparentType(type) {
|
|
57423
|
-
|
|
57428
|
+
// We obtain the base constraint for all instantiable types, except indexed access types of the form
|
|
57429
|
+
// { [P in K]: E }[X], where K is non-generic and X is generic. For those types, we instead substitute an
|
|
57430
|
+
// instantiation of E where P is replaced with X. We do this because getBaseConstraintOfType directly
|
|
57431
|
+
// lowers to an instantiation where X's constraint is substituted for X, which isn't always desirable.
|
|
57432
|
+
var t = !(type.flags & 465829888 /* Instantiable */) ? type :
|
|
57433
|
+
isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
|
|
57434
|
+
getBaseConstraintOfType(type) || unknownType;
|
|
57424
57435
|
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
|
|
57425
57436
|
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
|
|
57426
57437
|
t.flags & 402653316 /* StringLike */ ? globalStringType :
|
|
@@ -58036,6 +58047,8 @@ var ts;
|
|
|
58036
58047
|
case 205 /* PropertyAccessExpression */:
|
|
58037
58048
|
case 206 /* ElementAccessExpression */:
|
|
58038
58049
|
return traverse(node.expression);
|
|
58050
|
+
case 294 /* PropertyAssignment */:
|
|
58051
|
+
return traverse(node.initializer);
|
|
58039
58052
|
default:
|
|
58040
58053
|
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
|
|
58041
58054
|
}
|
|
@@ -65691,7 +65704,7 @@ var ts;
|
|
|
65691
65704
|
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
65692
65705
|
// no flags for all other types (including non-falsy literal types).
|
|
65693
65706
|
function getFalsyFlags(type) {
|
|
65694
|
-
return type.flags &
|
|
65707
|
+
return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
|
|
65695
65708
|
type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
65696
65709
|
type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
65697
65710
|
type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
|
|
@@ -66605,12 +66618,14 @@ var ts;
|
|
|
66605
66618
|
// not contain anyFunctionType when we come back to this argument for its second round
|
|
66606
66619
|
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
|
|
66607
66620
|
// when constructing types from type parameters that had no inference candidates).
|
|
66608
|
-
if (
|
|
66609
|
-
(priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
66621
|
+
if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
66610
66622
|
return;
|
|
66611
66623
|
}
|
|
66612
66624
|
var inference = getInferenceInfoForType(target);
|
|
66613
66625
|
if (inference) {
|
|
66626
|
+
if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */) {
|
|
66627
|
+
return;
|
|
66628
|
+
}
|
|
66614
66629
|
if (!inference.isFixed) {
|
|
66615
66630
|
if (inference.priority === undefined || priority < inference.priority) {
|
|
66616
66631
|
inference.candidates = undefined;
|
|
@@ -66641,21 +66656,19 @@ var ts;
|
|
|
66641
66656
|
inferencePriority = Math.min(inferencePriority, priority);
|
|
66642
66657
|
return;
|
|
66643
66658
|
}
|
|
66644
|
-
|
|
66645
|
-
|
|
66646
|
-
|
|
66647
|
-
|
|
66648
|
-
|
|
66649
|
-
|
|
66650
|
-
|
|
66651
|
-
|
|
66652
|
-
|
|
66653
|
-
|
|
66654
|
-
|
|
66655
|
-
|
|
66656
|
-
|
|
66657
|
-
invokeOnce(source, simplified_1, inferFromTypes);
|
|
66658
|
-
}
|
|
66659
|
+
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
|
|
66660
|
+
var simplified = getSimplifiedType(target, /*writing*/ false);
|
|
66661
|
+
if (simplified !== target) {
|
|
66662
|
+
inferFromTypes(source, simplified);
|
|
66663
|
+
}
|
|
66664
|
+
else if (target.flags & 8388608 /* IndexedAccess */) {
|
|
66665
|
+
var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
|
|
66666
|
+
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
|
|
66667
|
+
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
|
|
66668
|
+
if (indexType.flags & 465829888 /* Instantiable */) {
|
|
66669
|
+
var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
|
|
66670
|
+
if (simplified_1 && simplified_1 !== target) {
|
|
66671
|
+
inferFromTypes(source, simplified_1);
|
|
66659
66672
|
}
|
|
66660
66673
|
}
|
|
66661
66674
|
}
|
|
@@ -69525,7 +69538,7 @@ var ts;
|
|
|
69525
69538
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
69526
69539
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
69527
69540
|
(isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
|
|
69528
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69541
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69529
69542
|
}
|
|
69530
69543
|
function isExportOrExportExpression(location) {
|
|
69531
69544
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -72496,11 +72509,14 @@ var ts;
|
|
|
72496
72509
|
if (!ts.getContainingClass(privId)) {
|
|
72497
72510
|
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
72498
72511
|
}
|
|
72499
|
-
if (!ts.
|
|
72500
|
-
|
|
72501
|
-
|
|
72502
|
-
|
|
72503
|
-
|
|
72512
|
+
if (!ts.isForInStatement(privId.parent)) {
|
|
72513
|
+
if (!ts.isExpressionNode(privId)) {
|
|
72514
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
|
|
72515
|
+
}
|
|
72516
|
+
var isInOperation = ts.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101 /* InKeyword */;
|
|
72517
|
+
if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
|
|
72518
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
|
|
72519
|
+
}
|
|
72504
72520
|
}
|
|
72505
72521
|
return false;
|
|
72506
72522
|
}
|
|
@@ -82514,7 +82530,7 @@ var ts;
|
|
|
82514
82530
|
if (memberSymbol) {
|
|
82515
82531
|
var declaration = memberSymbol.valueDeclaration;
|
|
82516
82532
|
if (declaration !== member) {
|
|
82517
|
-
if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member)) {
|
|
82533
|
+
if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && ts.isEnumDeclaration(declaration.parent)) {
|
|
82518
82534
|
return getEnumMemberValue(declaration);
|
|
82519
82535
|
}
|
|
82520
82536
|
error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
@@ -85887,7 +85903,7 @@ var ts;
|
|
|
85887
85903
|
if (prop.kind === 295 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
|
|
85888
85904
|
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
|
|
85889
85905
|
// outside of destructuring it is a syntax error
|
|
85890
|
-
|
|
85906
|
+
grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
|
|
85891
85907
|
}
|
|
85892
85908
|
if (name.kind === 80 /* PrivateIdentifier */) {
|
|
85893
85909
|
grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -91851,7 +91867,7 @@ var ts;
|
|
|
91851
91867
|
var compilerOptions = context.getCompilerOptions();
|
|
91852
91868
|
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
91853
91869
|
var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
|
|
91854
|
-
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion <
|
|
91870
|
+
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ES2022 */;
|
|
91855
91871
|
// We don't need to transform `super` property access when targeting ES5, ES3 because
|
|
91856
91872
|
// the es2015 transformation handles those.
|
|
91857
91873
|
var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 /* ES2021 */ || !useDefineForClassFields) && languageVersion >= 2 /* ES2015 */;
|
|
@@ -91881,7 +91897,7 @@ var ts;
|
|
|
91881
91897
|
function transformSourceFile(node) {
|
|
91882
91898
|
var options = context.getCompilerOptions();
|
|
91883
91899
|
if (node.isDeclarationFile
|
|
91884
|
-
|| useDefineForClassFields && ts.getEmitScriptTarget(options)
|
|
91900
|
+
|| useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ES2022 */) {
|
|
91885
91901
|
return node;
|
|
91886
91902
|
}
|
|
91887
91903
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -92638,7 +92654,7 @@ var ts;
|
|
|
92638
92654
|
if (useDefineForClassFields) {
|
|
92639
92655
|
// If we are using define semantics and targeting ESNext or higher,
|
|
92640
92656
|
// then we don't need to transform any class properties.
|
|
92641
|
-
return languageVersion <
|
|
92657
|
+
return languageVersion < 9 /* ES2022 */;
|
|
92642
92658
|
}
|
|
92643
92659
|
return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
|
|
92644
92660
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20211218",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|