@typescript-deploys/pr-build 5.1.0-pr-53406-15 → 5.1.0-pr-49863-41
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 +78 -21
- package/lib/tsserver.js +78 -21
- package/lib/tsserverlibrary.d.ts +1 -0
- package/lib/tsserverlibrary.js +78 -21
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +78 -21
- package/lib/typingsInstaller.js +11 -0
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -7313,6 +7313,7 @@ var Diagnostics = {
|
|
|
7313
7313
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
7314
7314
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
7315
7315
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7316
|
+
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
7316
7317
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7317
7318
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7318
7319
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -33850,6 +33851,16 @@ var commandOptionsWithoutBuild = [
|
|
|
33850
33851
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
33851
33852
|
defaultValueDescription: false
|
|
33852
33853
|
},
|
|
33854
|
+
{
|
|
33855
|
+
name: "strictInstanceOfTypeParameters",
|
|
33856
|
+
type: "boolean",
|
|
33857
|
+
affectsSemanticDiagnostics: true,
|
|
33858
|
+
affectsBuildInfo: true,
|
|
33859
|
+
strictFlag: true,
|
|
33860
|
+
category: Diagnostics.Type_Checking,
|
|
33861
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
33862
|
+
defaultValueDescription: false
|
|
33863
|
+
},
|
|
33853
33864
|
{
|
|
33854
33865
|
name: "alwaysStrict",
|
|
33855
33866
|
type: "boolean",
|
|
@@ -42538,6 +42549,7 @@ function createTypeChecker(host) {
|
|
|
42538
42549
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
42539
42550
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42540
42551
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42552
|
+
var strictInstanceOfTypeParameters = true;
|
|
42541
42553
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42542
42554
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42543
42555
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -50511,9 +50523,30 @@ function createTypeChecker(host) {
|
|
|
50511
50523
|
}
|
|
50512
50524
|
}).parent;
|
|
50513
50525
|
}
|
|
50526
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
50527
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
50528
|
+
const objectFlags = getObjectFlags(classType);
|
|
50529
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
50530
|
+
return classType;
|
|
50531
|
+
}
|
|
50532
|
+
const variances = getVariances(classType);
|
|
50533
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
50534
|
+
if (!strictInstanceOfTypeParameters) {
|
|
50535
|
+
return anyType;
|
|
50536
|
+
}
|
|
50537
|
+
const variance = variances[i];
|
|
50538
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
50539
|
+
case 2 /* Contravariant */:
|
|
50540
|
+
case 3 /* Bivariant */:
|
|
50541
|
+
return neverType;
|
|
50542
|
+
}
|
|
50543
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
50544
|
+
});
|
|
50545
|
+
return createTypeReference(classType, typeArguments);
|
|
50546
|
+
}
|
|
50514
50547
|
function getTypeOfPrototypeProperty(prototype) {
|
|
50515
|
-
const
|
|
50516
|
-
return
|
|
50548
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
50549
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
50517
50550
|
}
|
|
50518
50551
|
function getTypeOfPropertyOfType(type, name) {
|
|
50519
50552
|
const prop = getPropertyOfType(type, name);
|
|
@@ -55804,7 +55837,7 @@ function createTypeChecker(host) {
|
|
|
55804
55837
|
}
|
|
55805
55838
|
}
|
|
55806
55839
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
55807
|
-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t)
|
|
55840
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
|
|
55808
55841
|
if (templates.length) {
|
|
55809
55842
|
let i = types.length;
|
|
55810
55843
|
while (i > 0) {
|
|
@@ -64993,8 +65026,8 @@ function createTypeChecker(host) {
|
|
|
64993
65026
|
if (symbol === void 0) {
|
|
64994
65027
|
return type;
|
|
64995
65028
|
}
|
|
64996
|
-
const classSymbol = symbol
|
|
64997
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
65029
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
65030
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
64998
65031
|
return getNarrowedType(
|
|
64999
65032
|
type,
|
|
65000
65033
|
targetType,
|
|
@@ -94612,10 +94645,13 @@ function transformJsx(context) {
|
|
|
94612
94645
|
return Debug.failBadSyntaxKind(node);
|
|
94613
94646
|
}
|
|
94614
94647
|
}
|
|
94648
|
+
function hasProto(obj) {
|
|
94649
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
94650
|
+
}
|
|
94615
94651
|
function hasKeyAfterPropsSpread(node) {
|
|
94616
94652
|
let spread = false;
|
|
94617
94653
|
for (const elem of node.attributes.properties) {
|
|
94618
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
94654
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
94619
94655
|
spread = true;
|
|
94620
94656
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
94621
94657
|
return true;
|
|
@@ -94781,7 +94817,10 @@ function transformJsx(context) {
|
|
|
94781
94817
|
}
|
|
94782
94818
|
return element;
|
|
94783
94819
|
}
|
|
94784
|
-
function
|
|
94820
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
94821
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
94822
|
+
return node.expression.properties;
|
|
94823
|
+
}
|
|
94785
94824
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
94786
94825
|
}
|
|
94787
94826
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -94789,30 +94828,48 @@ function transformJsx(context) {
|
|
|
94789
94828
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
94790
94829
|
}
|
|
94791
94830
|
function transformJsxAttributesToProps(attrs, children) {
|
|
94792
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
94831
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
94793
94832
|
if (children) {
|
|
94794
94833
|
props.push(children);
|
|
94795
94834
|
}
|
|
94796
94835
|
return props;
|
|
94797
94836
|
}
|
|
94798
94837
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
94799
|
-
const expressions =
|
|
94800
|
-
|
|
94801
|
-
|
|
94802
|
-
|
|
94803
|
-
(
|
|
94804
|
-
|
|
94805
|
-
|
|
94806
|
-
|
|
94807
|
-
|
|
94838
|
+
const expressions = [];
|
|
94839
|
+
let properties = [];
|
|
94840
|
+
for (const attr of attrs) {
|
|
94841
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
94842
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
94843
|
+
for (const prop of attr.expression.properties) {
|
|
94844
|
+
if (isSpreadAssignment(prop)) {
|
|
94845
|
+
finishObjectLiteralIfNeeded();
|
|
94846
|
+
expressions.push(prop.expression);
|
|
94847
|
+
continue;
|
|
94848
|
+
}
|
|
94849
|
+
properties.push(prop);
|
|
94850
|
+
}
|
|
94851
|
+
continue;
|
|
94852
|
+
}
|
|
94853
|
+
finishObjectLiteralIfNeeded();
|
|
94854
|
+
expressions.push(attr.expression);
|
|
94855
|
+
continue;
|
|
94856
|
+
}
|
|
94857
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
94808
94858
|
}
|
|
94809
94859
|
if (children) {
|
|
94810
|
-
|
|
94860
|
+
properties.push(children);
|
|
94861
|
+
}
|
|
94862
|
+
finishObjectLiteralIfNeeded();
|
|
94863
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
94864
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
94811
94865
|
}
|
|
94812
94866
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
94813
|
-
|
|
94814
|
-
|
|
94815
|
-
|
|
94867
|
+
function finishObjectLiteralIfNeeded() {
|
|
94868
|
+
if (properties.length) {
|
|
94869
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
94870
|
+
properties = [];
|
|
94871
|
+
}
|
|
94872
|
+
}
|
|
94816
94873
|
}
|
|
94817
94874
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
94818
94875
|
const name = getAttributeName(node);
|
package/lib/tsserver.js
CHANGED
|
@@ -10800,6 +10800,7 @@ var Diagnostics = {
|
|
|
10800
10800
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
10801
10801
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
10802
10802
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
10803
|
+
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
10803
10804
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
10804
10805
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
10805
10806
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -38211,6 +38212,16 @@ var commandOptionsWithoutBuild = [
|
|
|
38211
38212
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
38212
38213
|
defaultValueDescription: false
|
|
38213
38214
|
},
|
|
38215
|
+
{
|
|
38216
|
+
name: "strictInstanceOfTypeParameters",
|
|
38217
|
+
type: "boolean",
|
|
38218
|
+
affectsSemanticDiagnostics: true,
|
|
38219
|
+
affectsBuildInfo: true,
|
|
38220
|
+
strictFlag: true,
|
|
38221
|
+
category: Diagnostics.Type_Checking,
|
|
38222
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
38223
|
+
defaultValueDescription: false
|
|
38224
|
+
},
|
|
38214
38225
|
{
|
|
38215
38226
|
name: "alwaysStrict",
|
|
38216
38227
|
type: "boolean",
|
|
@@ -47165,6 +47176,7 @@ function createTypeChecker(host) {
|
|
|
47165
47176
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
47166
47177
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
47167
47178
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
47179
|
+
var strictInstanceOfTypeParameters = true;
|
|
47168
47180
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
47169
47181
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
47170
47182
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -55138,9 +55150,30 @@ function createTypeChecker(host) {
|
|
|
55138
55150
|
}
|
|
55139
55151
|
}).parent;
|
|
55140
55152
|
}
|
|
55153
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
55154
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
55155
|
+
const objectFlags = getObjectFlags(classType);
|
|
55156
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
55157
|
+
return classType;
|
|
55158
|
+
}
|
|
55159
|
+
const variances = getVariances(classType);
|
|
55160
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
55161
|
+
if (!strictInstanceOfTypeParameters) {
|
|
55162
|
+
return anyType;
|
|
55163
|
+
}
|
|
55164
|
+
const variance = variances[i];
|
|
55165
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
55166
|
+
case 2 /* Contravariant */:
|
|
55167
|
+
case 3 /* Bivariant */:
|
|
55168
|
+
return neverType;
|
|
55169
|
+
}
|
|
55170
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
55171
|
+
});
|
|
55172
|
+
return createTypeReference(classType, typeArguments);
|
|
55173
|
+
}
|
|
55141
55174
|
function getTypeOfPrototypeProperty(prototype) {
|
|
55142
|
-
const
|
|
55143
|
-
return
|
|
55175
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
55176
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
55144
55177
|
}
|
|
55145
55178
|
function getTypeOfPropertyOfType(type, name) {
|
|
55146
55179
|
const prop = getPropertyOfType(type, name);
|
|
@@ -60431,7 +60464,7 @@ function createTypeChecker(host) {
|
|
|
60431
60464
|
}
|
|
60432
60465
|
}
|
|
60433
60466
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
60434
|
-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t)
|
|
60467
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
|
|
60435
60468
|
if (templates.length) {
|
|
60436
60469
|
let i = types.length;
|
|
60437
60470
|
while (i > 0) {
|
|
@@ -69620,8 +69653,8 @@ function createTypeChecker(host) {
|
|
|
69620
69653
|
if (symbol === void 0) {
|
|
69621
69654
|
return type;
|
|
69622
69655
|
}
|
|
69623
|
-
const classSymbol = symbol
|
|
69624
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
69656
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
69657
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
69625
69658
|
return getNarrowedType(
|
|
69626
69659
|
type,
|
|
69627
69660
|
targetType,
|
|
@@ -99410,10 +99443,13 @@ function transformJsx(context) {
|
|
|
99410
99443
|
return Debug.failBadSyntaxKind(node);
|
|
99411
99444
|
}
|
|
99412
99445
|
}
|
|
99446
|
+
function hasProto(obj) {
|
|
99447
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
99448
|
+
}
|
|
99413
99449
|
function hasKeyAfterPropsSpread(node) {
|
|
99414
99450
|
let spread = false;
|
|
99415
99451
|
for (const elem of node.attributes.properties) {
|
|
99416
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
99452
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
99417
99453
|
spread = true;
|
|
99418
99454
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
99419
99455
|
return true;
|
|
@@ -99579,7 +99615,10 @@ function transformJsx(context) {
|
|
|
99579
99615
|
}
|
|
99580
99616
|
return element;
|
|
99581
99617
|
}
|
|
99582
|
-
function
|
|
99618
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
99619
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
99620
|
+
return node.expression.properties;
|
|
99621
|
+
}
|
|
99583
99622
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
99584
99623
|
}
|
|
99585
99624
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -99587,30 +99626,48 @@ function transformJsx(context) {
|
|
|
99587
99626
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
99588
99627
|
}
|
|
99589
99628
|
function transformJsxAttributesToProps(attrs, children) {
|
|
99590
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
99629
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
99591
99630
|
if (children) {
|
|
99592
99631
|
props.push(children);
|
|
99593
99632
|
}
|
|
99594
99633
|
return props;
|
|
99595
99634
|
}
|
|
99596
99635
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
99597
|
-
const expressions =
|
|
99598
|
-
|
|
99599
|
-
|
|
99600
|
-
|
|
99601
|
-
(
|
|
99602
|
-
|
|
99603
|
-
|
|
99604
|
-
|
|
99605
|
-
|
|
99636
|
+
const expressions = [];
|
|
99637
|
+
let properties = [];
|
|
99638
|
+
for (const attr of attrs) {
|
|
99639
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
99640
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
99641
|
+
for (const prop of attr.expression.properties) {
|
|
99642
|
+
if (isSpreadAssignment(prop)) {
|
|
99643
|
+
finishObjectLiteralIfNeeded();
|
|
99644
|
+
expressions.push(prop.expression);
|
|
99645
|
+
continue;
|
|
99646
|
+
}
|
|
99647
|
+
properties.push(prop);
|
|
99648
|
+
}
|
|
99649
|
+
continue;
|
|
99650
|
+
}
|
|
99651
|
+
finishObjectLiteralIfNeeded();
|
|
99652
|
+
expressions.push(attr.expression);
|
|
99653
|
+
continue;
|
|
99654
|
+
}
|
|
99655
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
99606
99656
|
}
|
|
99607
99657
|
if (children) {
|
|
99608
|
-
|
|
99658
|
+
properties.push(children);
|
|
99659
|
+
}
|
|
99660
|
+
finishObjectLiteralIfNeeded();
|
|
99661
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
99662
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
99609
99663
|
}
|
|
99610
99664
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
99611
|
-
|
|
99612
|
-
|
|
99613
|
-
|
|
99665
|
+
function finishObjectLiteralIfNeeded() {
|
|
99666
|
+
if (properties.length) {
|
|
99667
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
99668
|
+
properties = [];
|
|
99669
|
+
}
|
|
99670
|
+
}
|
|
99614
99671
|
}
|
|
99615
99672
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
99616
99673
|
const name = getAttributeName(node);
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -7141,6 +7141,7 @@ declare namespace ts {
|
|
|
7141
7141
|
strictBindCallApply?: boolean;
|
|
7142
7142
|
strictNullChecks?: boolean;
|
|
7143
7143
|
strictPropertyInitialization?: boolean;
|
|
7144
|
+
strictInstanceOfTypeParameters?: boolean;
|
|
7144
7145
|
stripInternal?: boolean;
|
|
7145
7146
|
suppressExcessPropertyErrors?: boolean;
|
|
7146
7147
|
suppressImplicitAnyIndexErrors?: boolean;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -8623,6 +8623,7 @@ ${lanes.join("\n")}
|
|
|
8623
8623
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
8624
8624
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
8625
8625
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
8626
|
+
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
8626
8627
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8627
8628
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8628
8629
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37734,6 +37735,16 @@ ${lanes.join("\n")}
|
|
|
37734
37735
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37735
37736
|
defaultValueDescription: false
|
|
37736
37737
|
},
|
|
37738
|
+
{
|
|
37739
|
+
name: "strictInstanceOfTypeParameters",
|
|
37740
|
+
type: "boolean",
|
|
37741
|
+
affectsSemanticDiagnostics: true,
|
|
37742
|
+
affectsBuildInfo: true,
|
|
37743
|
+
strictFlag: true,
|
|
37744
|
+
category: Diagnostics.Type_Checking,
|
|
37745
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37746
|
+
defaultValueDescription: false
|
|
37747
|
+
},
|
|
37737
37748
|
{
|
|
37738
37749
|
name: "alwaysStrict",
|
|
37739
37750
|
type: "boolean",
|
|
@@ -44973,6 +44984,7 @@ ${lanes.join("\n")}
|
|
|
44973
44984
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
44974
44985
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
44975
44986
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
44987
|
+
var strictInstanceOfTypeParameters = true;
|
|
44976
44988
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
44977
44989
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
44978
44990
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -52946,9 +52958,30 @@ ${lanes.join("\n")}
|
|
|
52946
52958
|
}
|
|
52947
52959
|
}).parent;
|
|
52948
52960
|
}
|
|
52961
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
52962
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
52963
|
+
const objectFlags = getObjectFlags(classType);
|
|
52964
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
52965
|
+
return classType;
|
|
52966
|
+
}
|
|
52967
|
+
const variances = getVariances(classType);
|
|
52968
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
52969
|
+
if (!strictInstanceOfTypeParameters) {
|
|
52970
|
+
return anyType;
|
|
52971
|
+
}
|
|
52972
|
+
const variance = variances[i];
|
|
52973
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
52974
|
+
case 2 /* Contravariant */:
|
|
52975
|
+
case 3 /* Bivariant */:
|
|
52976
|
+
return neverType;
|
|
52977
|
+
}
|
|
52978
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
52979
|
+
});
|
|
52980
|
+
return createTypeReference(classType, typeArguments);
|
|
52981
|
+
}
|
|
52949
52982
|
function getTypeOfPrototypeProperty(prototype) {
|
|
52950
|
-
const
|
|
52951
|
-
return
|
|
52983
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
52984
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
52952
52985
|
}
|
|
52953
52986
|
function getTypeOfPropertyOfType(type, name) {
|
|
52954
52987
|
const prop = getPropertyOfType(type, name);
|
|
@@ -58239,7 +58272,7 @@ ${lanes.join("\n")}
|
|
|
58239
58272
|
}
|
|
58240
58273
|
}
|
|
58241
58274
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
58242
|
-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t)
|
|
58275
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
|
|
58243
58276
|
if (templates.length) {
|
|
58244
58277
|
let i = types.length;
|
|
58245
58278
|
while (i > 0) {
|
|
@@ -67428,8 +67461,8 @@ ${lanes.join("\n")}
|
|
|
67428
67461
|
if (symbol === void 0) {
|
|
67429
67462
|
return type;
|
|
67430
67463
|
}
|
|
67431
|
-
const classSymbol = symbol
|
|
67432
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67464
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
67465
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
67433
67466
|
return getNarrowedType(
|
|
67434
67467
|
type,
|
|
67435
67468
|
targetType,
|
|
@@ -97453,10 +97486,13 @@ ${lanes.join("\n")}
|
|
|
97453
97486
|
return Debug.failBadSyntaxKind(node);
|
|
97454
97487
|
}
|
|
97455
97488
|
}
|
|
97489
|
+
function hasProto(obj) {
|
|
97490
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
97491
|
+
}
|
|
97456
97492
|
function hasKeyAfterPropsSpread(node) {
|
|
97457
97493
|
let spread = false;
|
|
97458
97494
|
for (const elem of node.attributes.properties) {
|
|
97459
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
97495
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
97460
97496
|
spread = true;
|
|
97461
97497
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
97462
97498
|
return true;
|
|
@@ -97622,7 +97658,10 @@ ${lanes.join("\n")}
|
|
|
97622
97658
|
}
|
|
97623
97659
|
return element;
|
|
97624
97660
|
}
|
|
97625
|
-
function
|
|
97661
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
97662
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
97663
|
+
return node.expression.properties;
|
|
97664
|
+
}
|
|
97626
97665
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
97627
97666
|
}
|
|
97628
97667
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -97630,30 +97669,48 @@ ${lanes.join("\n")}
|
|
|
97630
97669
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
97631
97670
|
}
|
|
97632
97671
|
function transformJsxAttributesToProps(attrs, children) {
|
|
97633
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
97672
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
97634
97673
|
if (children) {
|
|
97635
97674
|
props.push(children);
|
|
97636
97675
|
}
|
|
97637
97676
|
return props;
|
|
97638
97677
|
}
|
|
97639
97678
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
97640
|
-
const expressions =
|
|
97641
|
-
|
|
97642
|
-
|
|
97643
|
-
|
|
97644
|
-
(
|
|
97645
|
-
|
|
97646
|
-
|
|
97647
|
-
|
|
97648
|
-
|
|
97679
|
+
const expressions = [];
|
|
97680
|
+
let properties = [];
|
|
97681
|
+
for (const attr of attrs) {
|
|
97682
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
97683
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
97684
|
+
for (const prop of attr.expression.properties) {
|
|
97685
|
+
if (isSpreadAssignment(prop)) {
|
|
97686
|
+
finishObjectLiteralIfNeeded();
|
|
97687
|
+
expressions.push(prop.expression);
|
|
97688
|
+
continue;
|
|
97689
|
+
}
|
|
97690
|
+
properties.push(prop);
|
|
97691
|
+
}
|
|
97692
|
+
continue;
|
|
97693
|
+
}
|
|
97694
|
+
finishObjectLiteralIfNeeded();
|
|
97695
|
+
expressions.push(attr.expression);
|
|
97696
|
+
continue;
|
|
97697
|
+
}
|
|
97698
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
97649
97699
|
}
|
|
97650
97700
|
if (children) {
|
|
97651
|
-
|
|
97701
|
+
properties.push(children);
|
|
97702
|
+
}
|
|
97703
|
+
finishObjectLiteralIfNeeded();
|
|
97704
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
97705
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
97652
97706
|
}
|
|
97653
97707
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
97654
|
-
|
|
97655
|
-
|
|
97656
|
-
|
|
97708
|
+
function finishObjectLiteralIfNeeded() {
|
|
97709
|
+
if (properties.length) {
|
|
97710
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
97711
|
+
properties = [];
|
|
97712
|
+
}
|
|
97713
|
+
}
|
|
97657
97714
|
}
|
|
97658
97715
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
97659
97716
|
const name = getAttributeName(node);
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3198,6 +3198,7 @@ declare namespace ts {
|
|
|
3198
3198
|
strictBindCallApply?: boolean;
|
|
3199
3199
|
strictNullChecks?: boolean;
|
|
3200
3200
|
strictPropertyInitialization?: boolean;
|
|
3201
|
+
strictInstanceOfTypeParameters?: boolean;
|
|
3201
3202
|
stripInternal?: boolean;
|
|
3202
3203
|
suppressExcessPropertyErrors?: boolean;
|
|
3203
3204
|
suppressImplicitAnyIndexErrors?: boolean;
|
package/lib/typescript.js
CHANGED
|
@@ -8623,6 +8623,7 @@ ${lanes.join("\n")}
|
|
|
8623
8623
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
8624
8624
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
8625
8625
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
8626
|
+
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
8626
8627
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8627
8628
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8628
8629
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37734,6 +37735,16 @@ ${lanes.join("\n")}
|
|
|
37734
37735
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37735
37736
|
defaultValueDescription: false
|
|
37736
37737
|
},
|
|
37738
|
+
{
|
|
37739
|
+
name: "strictInstanceOfTypeParameters",
|
|
37740
|
+
type: "boolean",
|
|
37741
|
+
affectsSemanticDiagnostics: true,
|
|
37742
|
+
affectsBuildInfo: true,
|
|
37743
|
+
strictFlag: true,
|
|
37744
|
+
category: Diagnostics.Type_Checking,
|
|
37745
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37746
|
+
defaultValueDescription: false
|
|
37747
|
+
},
|
|
37737
37748
|
{
|
|
37738
37749
|
name: "alwaysStrict",
|
|
37739
37750
|
type: "boolean",
|
|
@@ -44973,6 +44984,7 @@ ${lanes.join("\n")}
|
|
|
44973
44984
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
44974
44985
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
44975
44986
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
44987
|
+
var strictInstanceOfTypeParameters = true;
|
|
44976
44988
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
44977
44989
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
44978
44990
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -52946,9 +52958,30 @@ ${lanes.join("\n")}
|
|
|
52946
52958
|
}
|
|
52947
52959
|
}).parent;
|
|
52948
52960
|
}
|
|
52961
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
52962
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
52963
|
+
const objectFlags = getObjectFlags(classType);
|
|
52964
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
52965
|
+
return classType;
|
|
52966
|
+
}
|
|
52967
|
+
const variances = getVariances(classType);
|
|
52968
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
52969
|
+
if (!strictInstanceOfTypeParameters) {
|
|
52970
|
+
return anyType;
|
|
52971
|
+
}
|
|
52972
|
+
const variance = variances[i];
|
|
52973
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
52974
|
+
case 2 /* Contravariant */:
|
|
52975
|
+
case 3 /* Bivariant */:
|
|
52976
|
+
return neverType;
|
|
52977
|
+
}
|
|
52978
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
52979
|
+
});
|
|
52980
|
+
return createTypeReference(classType, typeArguments);
|
|
52981
|
+
}
|
|
52949
52982
|
function getTypeOfPrototypeProperty(prototype) {
|
|
52950
|
-
const
|
|
52951
|
-
return
|
|
52983
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
52984
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
52952
52985
|
}
|
|
52953
52986
|
function getTypeOfPropertyOfType(type, name) {
|
|
52954
52987
|
const prop = getPropertyOfType(type, name);
|
|
@@ -58239,7 +58272,7 @@ ${lanes.join("\n")}
|
|
|
58239
58272
|
}
|
|
58240
58273
|
}
|
|
58241
58274
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
58242
|
-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t)
|
|
58275
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
|
|
58243
58276
|
if (templates.length) {
|
|
58244
58277
|
let i = types.length;
|
|
58245
58278
|
while (i > 0) {
|
|
@@ -67428,8 +67461,8 @@ ${lanes.join("\n")}
|
|
|
67428
67461
|
if (symbol === void 0) {
|
|
67429
67462
|
return type;
|
|
67430
67463
|
}
|
|
67431
|
-
const classSymbol = symbol
|
|
67432
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67464
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
67465
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
67433
67466
|
return getNarrowedType(
|
|
67434
67467
|
type,
|
|
67435
67468
|
targetType,
|
|
@@ -97453,10 +97486,13 @@ ${lanes.join("\n")}
|
|
|
97453
97486
|
return Debug.failBadSyntaxKind(node);
|
|
97454
97487
|
}
|
|
97455
97488
|
}
|
|
97489
|
+
function hasProto(obj) {
|
|
97490
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
97491
|
+
}
|
|
97456
97492
|
function hasKeyAfterPropsSpread(node) {
|
|
97457
97493
|
let spread = false;
|
|
97458
97494
|
for (const elem of node.attributes.properties) {
|
|
97459
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
97495
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
97460
97496
|
spread = true;
|
|
97461
97497
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
97462
97498
|
return true;
|
|
@@ -97622,7 +97658,10 @@ ${lanes.join("\n")}
|
|
|
97622
97658
|
}
|
|
97623
97659
|
return element;
|
|
97624
97660
|
}
|
|
97625
|
-
function
|
|
97661
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
97662
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
97663
|
+
return node.expression.properties;
|
|
97664
|
+
}
|
|
97626
97665
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
97627
97666
|
}
|
|
97628
97667
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -97630,30 +97669,48 @@ ${lanes.join("\n")}
|
|
|
97630
97669
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
97631
97670
|
}
|
|
97632
97671
|
function transformJsxAttributesToProps(attrs, children) {
|
|
97633
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
97672
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
97634
97673
|
if (children) {
|
|
97635
97674
|
props.push(children);
|
|
97636
97675
|
}
|
|
97637
97676
|
return props;
|
|
97638
97677
|
}
|
|
97639
97678
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
97640
|
-
const expressions =
|
|
97641
|
-
|
|
97642
|
-
|
|
97643
|
-
|
|
97644
|
-
(
|
|
97645
|
-
|
|
97646
|
-
|
|
97647
|
-
|
|
97648
|
-
|
|
97679
|
+
const expressions = [];
|
|
97680
|
+
let properties = [];
|
|
97681
|
+
for (const attr of attrs) {
|
|
97682
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
97683
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
97684
|
+
for (const prop of attr.expression.properties) {
|
|
97685
|
+
if (isSpreadAssignment(prop)) {
|
|
97686
|
+
finishObjectLiteralIfNeeded();
|
|
97687
|
+
expressions.push(prop.expression);
|
|
97688
|
+
continue;
|
|
97689
|
+
}
|
|
97690
|
+
properties.push(prop);
|
|
97691
|
+
}
|
|
97692
|
+
continue;
|
|
97693
|
+
}
|
|
97694
|
+
finishObjectLiteralIfNeeded();
|
|
97695
|
+
expressions.push(attr.expression);
|
|
97696
|
+
continue;
|
|
97697
|
+
}
|
|
97698
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
97649
97699
|
}
|
|
97650
97700
|
if (children) {
|
|
97651
|
-
|
|
97701
|
+
properties.push(children);
|
|
97702
|
+
}
|
|
97703
|
+
finishObjectLiteralIfNeeded();
|
|
97704
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
97705
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
97652
97706
|
}
|
|
97653
97707
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
97654
|
-
|
|
97655
|
-
|
|
97656
|
-
|
|
97708
|
+
function finishObjectLiteralIfNeeded() {
|
|
97709
|
+
if (properties.length) {
|
|
97710
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
97711
|
+
properties = [];
|
|
97712
|
+
}
|
|
97713
|
+
}
|
|
97657
97714
|
}
|
|
97658
97715
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
97659
97716
|
const name = getAttributeName(node);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -6693,6 +6693,7 @@ var Diagnostics = {
|
|
|
6693
6693
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
6694
6694
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
6695
6695
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
6696
|
+
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
6696
6697
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
6697
6698
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
6698
6699
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -25906,6 +25907,16 @@ var commandOptionsWithoutBuild = [
|
|
|
25906
25907
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
25907
25908
|
defaultValueDescription: false
|
|
25908
25909
|
},
|
|
25910
|
+
{
|
|
25911
|
+
name: "strictInstanceOfTypeParameters",
|
|
25912
|
+
type: "boolean",
|
|
25913
|
+
affectsSemanticDiagnostics: true,
|
|
25914
|
+
affectsBuildInfo: true,
|
|
25915
|
+
strictFlag: true,
|
|
25916
|
+
category: Diagnostics.Type_Checking,
|
|
25917
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
25918
|
+
defaultValueDescription: false
|
|
25919
|
+
},
|
|
25909
25920
|
{
|
|
25910
25921
|
name: "alwaysStrict",
|
|
25911
25922
|
type: "boolean",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-pr-
|
|
5
|
+
"version": "5.1.0-pr-49863-41",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "14.21.1",
|
|
115
115
|
"npm": "8.19.3"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "30e1c3216ad5c9d403ef25217a94174ef7dd1340"
|
|
118
118
|
}
|