typescript 4.6.0-dev.20211214 → 4.6.0-dev.20211219
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 +43 -31
- package/lib/tsserver.js +50 -41
- package/lib/tsserverlibrary.js +50 -41
- package/lib/typescript.js +50 -41
- package/lib/typescriptServices.js +50 -41
- package/lib/typingsInstaller.js +50 -34
- package/package.json +1 -1
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.20211219";
|
|
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
|
}
|
|
@@ -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
|
}
|
|
@@ -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.20211219",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|