@typescript-deploys/pr-build 5.1.0-pr-53292-2 → 5.1.0-pr-53300-9
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 +46 -6
- package/lib/tsserver.js +46 -6
- package/lib/tsserverlibrary.d.ts +1 -0
- package/lib/tsserverlibrary.js +46 -6
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +46 -6
- package/lib/typingsInstaller.js +21 -13
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -7333,6 +7333,7 @@ var Diagnostics = {
|
|
|
7333
7333
|
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."),
|
|
7334
7334
|
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'."),
|
|
7335
7335
|
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."),
|
|
7336
|
+
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."),
|
|
7336
7337
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7337
7338
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7338
7339
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -33858,6 +33859,16 @@ var commandOptionsWithoutBuild = [
|
|
|
33858
33859
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
33859
33860
|
defaultValueDescription: false
|
|
33860
33861
|
},
|
|
33862
|
+
{
|
|
33863
|
+
name: "strictInstanceOfTypeParameters",
|
|
33864
|
+
type: "boolean",
|
|
33865
|
+
affectsSemanticDiagnostics: true,
|
|
33866
|
+
affectsBuildInfo: true,
|
|
33867
|
+
strictFlag: true,
|
|
33868
|
+
category: Diagnostics.Type_Checking,
|
|
33869
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
33870
|
+
defaultValueDescription: false
|
|
33871
|
+
},
|
|
33861
33872
|
{
|
|
33862
33873
|
name: "alwaysStrict",
|
|
33863
33874
|
type: "boolean",
|
|
@@ -42661,6 +42672,7 @@ function createTypeChecker(host) {
|
|
|
42661
42672
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
42662
42673
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42663
42674
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42675
|
+
var strictInstanceOfTypeParameters = true;
|
|
42664
42676
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42665
42677
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42666
42678
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -50627,9 +50639,32 @@ function createTypeChecker(host) {
|
|
|
50627
50639
|
}
|
|
50628
50640
|
}).parent;
|
|
50629
50641
|
}
|
|
50642
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
50643
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
50644
|
+
const objectFlags = getObjectFlags(classType);
|
|
50645
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
50646
|
+
return classType;
|
|
50647
|
+
}
|
|
50648
|
+
const variances = getVariances(classType);
|
|
50649
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
50650
|
+
if (!strictInstanceOfTypeParameters) {
|
|
50651
|
+
return anyType;
|
|
50652
|
+
}
|
|
50653
|
+
const variance = variances[i];
|
|
50654
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
50655
|
+
case 4 /* Independent */:
|
|
50656
|
+
case 3 /* Bivariant */:
|
|
50657
|
+
return anyType;
|
|
50658
|
+
case 0 /* Invariant */:
|
|
50659
|
+
return unknownType;
|
|
50660
|
+
}
|
|
50661
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
50662
|
+
});
|
|
50663
|
+
return createTypeReference(classType, typeArguments);
|
|
50664
|
+
}
|
|
50630
50665
|
function getTypeOfPrototypeProperty(prototype) {
|
|
50631
|
-
const
|
|
50632
|
-
return
|
|
50666
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
50667
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
50633
50668
|
}
|
|
50634
50669
|
function getTypeOfPropertyOfType(type, name) {
|
|
50635
50670
|
const prop = getPropertyOfType(type, name);
|
|
@@ -65073,8 +65108,8 @@ function createTypeChecker(host) {
|
|
|
65073
65108
|
if (symbol === void 0) {
|
|
65074
65109
|
return type;
|
|
65075
65110
|
}
|
|
65076
|
-
const classSymbol = symbol
|
|
65077
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
65111
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
65112
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
65078
65113
|
return getNarrowedType(
|
|
65079
65114
|
type,
|
|
65080
65115
|
targetType,
|
|
@@ -66525,7 +66560,7 @@ function createTypeChecker(host) {
|
|
|
66525
66560
|
return void 0;
|
|
66526
66561
|
}
|
|
66527
66562
|
}
|
|
66528
|
-
return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
66563
|
+
return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
66529
66564
|
}
|
|
66530
66565
|
case 1 /* ExportsProperty */:
|
|
66531
66566
|
case 6 /* Prototype */:
|
|
@@ -67423,7 +67458,7 @@ function createTypeChecker(host) {
|
|
|
67423
67458
|
const inConstContext = isConstContext(node);
|
|
67424
67459
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
67425
67460
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
67426
|
-
const enumTag = getJSDocEnumTag(node);
|
|
67461
|
+
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
67427
67462
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
67428
67463
|
let objectFlags = freshObjectLiteralFlag;
|
|
67429
67464
|
let patternWithComputedProperties = false;
|
|
@@ -72180,6 +72215,11 @@ function createTypeChecker(host) {
|
|
|
72180
72215
|
} else {
|
|
72181
72216
|
assignNonContextualParameterTypes(signature);
|
|
72182
72217
|
}
|
|
72218
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
72219
|
+
const inferenceContext = getInferenceContext(node);
|
|
72220
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
72221
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
72222
|
+
}
|
|
72183
72223
|
}
|
|
72184
72224
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
72185
72225
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
package/lib/tsserver.js
CHANGED
|
@@ -10795,6 +10795,7 @@ var Diagnostics = {
|
|
|
10795
10795
|
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."),
|
|
10796
10796
|
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'."),
|
|
10797
10797
|
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."),
|
|
10798
|
+
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."),
|
|
10798
10799
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
10799
10800
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
10800
10801
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -38194,6 +38195,16 @@ var commandOptionsWithoutBuild = [
|
|
|
38194
38195
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
38195
38196
|
defaultValueDescription: false
|
|
38196
38197
|
},
|
|
38198
|
+
{
|
|
38199
|
+
name: "strictInstanceOfTypeParameters",
|
|
38200
|
+
type: "boolean",
|
|
38201
|
+
affectsSemanticDiagnostics: true,
|
|
38202
|
+
affectsBuildInfo: true,
|
|
38203
|
+
strictFlag: true,
|
|
38204
|
+
category: Diagnostics.Type_Checking,
|
|
38205
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
38206
|
+
defaultValueDescription: false
|
|
38207
|
+
},
|
|
38197
38208
|
{
|
|
38198
38209
|
name: "alwaysStrict",
|
|
38199
38210
|
type: "boolean",
|
|
@@ -47258,6 +47269,7 @@ function createTypeChecker(host) {
|
|
|
47258
47269
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
47259
47270
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
47260
47271
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
47272
|
+
var strictInstanceOfTypeParameters = true;
|
|
47261
47273
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
47262
47274
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
47263
47275
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -55224,9 +55236,32 @@ function createTypeChecker(host) {
|
|
|
55224
55236
|
}
|
|
55225
55237
|
}).parent;
|
|
55226
55238
|
}
|
|
55239
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
55240
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
55241
|
+
const objectFlags = getObjectFlags(classType);
|
|
55242
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
55243
|
+
return classType;
|
|
55244
|
+
}
|
|
55245
|
+
const variances = getVariances(classType);
|
|
55246
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
55247
|
+
if (!strictInstanceOfTypeParameters) {
|
|
55248
|
+
return anyType;
|
|
55249
|
+
}
|
|
55250
|
+
const variance = variances[i];
|
|
55251
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
55252
|
+
case 4 /* Independent */:
|
|
55253
|
+
case 3 /* Bivariant */:
|
|
55254
|
+
return anyType;
|
|
55255
|
+
case 0 /* Invariant */:
|
|
55256
|
+
return unknownType;
|
|
55257
|
+
}
|
|
55258
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
55259
|
+
});
|
|
55260
|
+
return createTypeReference(classType, typeArguments);
|
|
55261
|
+
}
|
|
55227
55262
|
function getTypeOfPrototypeProperty(prototype) {
|
|
55228
|
-
const
|
|
55229
|
-
return
|
|
55263
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
55264
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
55230
55265
|
}
|
|
55231
55266
|
function getTypeOfPropertyOfType(type, name) {
|
|
55232
55267
|
const prop = getPropertyOfType(type, name);
|
|
@@ -69670,8 +69705,8 @@ function createTypeChecker(host) {
|
|
|
69670
69705
|
if (symbol === void 0) {
|
|
69671
69706
|
return type;
|
|
69672
69707
|
}
|
|
69673
|
-
const classSymbol = symbol
|
|
69674
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
69708
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
69709
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
69675
69710
|
return getNarrowedType(
|
|
69676
69711
|
type,
|
|
69677
69712
|
targetType,
|
|
@@ -71122,7 +71157,7 @@ function createTypeChecker(host) {
|
|
|
71122
71157
|
return void 0;
|
|
71123
71158
|
}
|
|
71124
71159
|
}
|
|
71125
|
-
return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
71160
|
+
return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
71126
71161
|
}
|
|
71127
71162
|
case 1 /* ExportsProperty */:
|
|
71128
71163
|
case 6 /* Prototype */:
|
|
@@ -72020,7 +72055,7 @@ function createTypeChecker(host) {
|
|
|
72020
72055
|
const inConstContext = isConstContext(node);
|
|
72021
72056
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
72022
72057
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
72023
|
-
const enumTag = getJSDocEnumTag(node);
|
|
72058
|
+
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
72024
72059
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
72025
72060
|
let objectFlags = freshObjectLiteralFlag;
|
|
72026
72061
|
let patternWithComputedProperties = false;
|
|
@@ -76777,6 +76812,11 @@ function createTypeChecker(host) {
|
|
|
76777
76812
|
} else {
|
|
76778
76813
|
assignNonContextualParameterTypes(signature);
|
|
76779
76814
|
}
|
|
76815
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
76816
|
+
const inferenceContext = getInferenceContext(node);
|
|
76817
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
76818
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
76819
|
+
}
|
|
76780
76820
|
}
|
|
76781
76821
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
76782
76822
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
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
|
@@ -8619,6 +8619,7 @@ ${lanes.join("\n")}
|
|
|
8619
8619
|
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."),
|
|
8620
8620
|
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'."),
|
|
8621
8621
|
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."),
|
|
8622
|
+
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."),
|
|
8622
8623
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8623
8624
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8624
8625
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37848,6 +37849,16 @@ ${lanes.join("\n")}
|
|
|
37848
37849
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37849
37850
|
defaultValueDescription: false
|
|
37850
37851
|
},
|
|
37852
|
+
{
|
|
37853
|
+
name: "strictInstanceOfTypeParameters",
|
|
37854
|
+
type: "boolean",
|
|
37855
|
+
affectsSemanticDiagnostics: true,
|
|
37856
|
+
affectsBuildInfo: true,
|
|
37857
|
+
strictFlag: true,
|
|
37858
|
+
category: Diagnostics.Type_Checking,
|
|
37859
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37860
|
+
defaultValueDescription: false
|
|
37861
|
+
},
|
|
37851
37862
|
{
|
|
37852
37863
|
name: "alwaysStrict",
|
|
37853
37864
|
type: "boolean",
|
|
@@ -45068,6 +45079,7 @@ ${lanes.join("\n")}
|
|
|
45068
45079
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
45069
45080
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45070
45081
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45082
|
+
var strictInstanceOfTypeParameters = true;
|
|
45071
45083
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45072
45084
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45073
45085
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -53034,9 +53046,32 @@ ${lanes.join("\n")}
|
|
|
53034
53046
|
}
|
|
53035
53047
|
}).parent;
|
|
53036
53048
|
}
|
|
53049
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
53050
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
53051
|
+
const objectFlags = getObjectFlags(classType);
|
|
53052
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
53053
|
+
return classType;
|
|
53054
|
+
}
|
|
53055
|
+
const variances = getVariances(classType);
|
|
53056
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
53057
|
+
if (!strictInstanceOfTypeParameters) {
|
|
53058
|
+
return anyType;
|
|
53059
|
+
}
|
|
53060
|
+
const variance = variances[i];
|
|
53061
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
53062
|
+
case 4 /* Independent */:
|
|
53063
|
+
case 3 /* Bivariant */:
|
|
53064
|
+
return anyType;
|
|
53065
|
+
case 0 /* Invariant */:
|
|
53066
|
+
return unknownType;
|
|
53067
|
+
}
|
|
53068
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
53069
|
+
});
|
|
53070
|
+
return createTypeReference(classType, typeArguments);
|
|
53071
|
+
}
|
|
53037
53072
|
function getTypeOfPrototypeProperty(prototype) {
|
|
53038
|
-
const
|
|
53039
|
-
return
|
|
53073
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
53074
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
53040
53075
|
}
|
|
53041
53076
|
function getTypeOfPropertyOfType(type, name) {
|
|
53042
53077
|
const prop = getPropertyOfType(type, name);
|
|
@@ -67480,8 +67515,8 @@ ${lanes.join("\n")}
|
|
|
67480
67515
|
if (symbol === void 0) {
|
|
67481
67516
|
return type;
|
|
67482
67517
|
}
|
|
67483
|
-
const classSymbol = symbol
|
|
67484
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67518
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
67519
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
67485
67520
|
return getNarrowedType(
|
|
67486
67521
|
type,
|
|
67487
67522
|
targetType,
|
|
@@ -68932,7 +68967,7 @@ ${lanes.join("\n")}
|
|
|
68932
68967
|
return void 0;
|
|
68933
68968
|
}
|
|
68934
68969
|
}
|
|
68935
|
-
return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
68970
|
+
return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
68936
68971
|
}
|
|
68937
68972
|
case 1 /* ExportsProperty */:
|
|
68938
68973
|
case 6 /* Prototype */:
|
|
@@ -69830,7 +69865,7 @@ ${lanes.join("\n")}
|
|
|
69830
69865
|
const inConstContext = isConstContext(node);
|
|
69831
69866
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
69832
69867
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
69833
|
-
const enumTag = getJSDocEnumTag(node);
|
|
69868
|
+
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
69834
69869
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
69835
69870
|
let objectFlags = freshObjectLiteralFlag;
|
|
69836
69871
|
let patternWithComputedProperties = false;
|
|
@@ -74587,6 +74622,11 @@ ${lanes.join("\n")}
|
|
|
74587
74622
|
} else {
|
|
74588
74623
|
assignNonContextualParameterTypes(signature);
|
|
74589
74624
|
}
|
|
74625
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
74626
|
+
const inferenceContext = getInferenceContext(node);
|
|
74627
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
74628
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
74629
|
+
}
|
|
74590
74630
|
}
|
|
74591
74631
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
74592
74632
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
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
|
@@ -8619,6 +8619,7 @@ ${lanes.join("\n")}
|
|
|
8619
8619
|
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."),
|
|
8620
8620
|
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'."),
|
|
8621
8621
|
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."),
|
|
8622
|
+
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."),
|
|
8622
8623
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8623
8624
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8624
8625
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37848,6 +37849,16 @@ ${lanes.join("\n")}
|
|
|
37848
37849
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37849
37850
|
defaultValueDescription: false
|
|
37850
37851
|
},
|
|
37852
|
+
{
|
|
37853
|
+
name: "strictInstanceOfTypeParameters",
|
|
37854
|
+
type: "boolean",
|
|
37855
|
+
affectsSemanticDiagnostics: true,
|
|
37856
|
+
affectsBuildInfo: true,
|
|
37857
|
+
strictFlag: true,
|
|
37858
|
+
category: Diagnostics.Type_Checking,
|
|
37859
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37860
|
+
defaultValueDescription: false
|
|
37861
|
+
},
|
|
37851
37862
|
{
|
|
37852
37863
|
name: "alwaysStrict",
|
|
37853
37864
|
type: "boolean",
|
|
@@ -45068,6 +45079,7 @@ ${lanes.join("\n")}
|
|
|
45068
45079
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
45069
45080
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45070
45081
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45082
|
+
var strictInstanceOfTypeParameters = true;
|
|
45071
45083
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45072
45084
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45073
45085
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -53034,9 +53046,32 @@ ${lanes.join("\n")}
|
|
|
53034
53046
|
}
|
|
53035
53047
|
}).parent;
|
|
53036
53048
|
}
|
|
53049
|
+
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
53050
|
+
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
53051
|
+
const objectFlags = getObjectFlags(classType);
|
|
53052
|
+
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
53053
|
+
return classType;
|
|
53054
|
+
}
|
|
53055
|
+
const variances = getVariances(classType);
|
|
53056
|
+
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
53057
|
+
if (!strictInstanceOfTypeParameters) {
|
|
53058
|
+
return anyType;
|
|
53059
|
+
}
|
|
53060
|
+
const variance = variances[i];
|
|
53061
|
+
switch (variance & 7 /* VarianceMask */) {
|
|
53062
|
+
case 4 /* Independent */:
|
|
53063
|
+
case 3 /* Bivariant */:
|
|
53064
|
+
return anyType;
|
|
53065
|
+
case 0 /* Invariant */:
|
|
53066
|
+
return unknownType;
|
|
53067
|
+
}
|
|
53068
|
+
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
53069
|
+
});
|
|
53070
|
+
return createTypeReference(classType, typeArguments);
|
|
53071
|
+
}
|
|
53037
53072
|
function getTypeOfPrototypeProperty(prototype) {
|
|
53038
|
-
const
|
|
53039
|
-
return
|
|
53073
|
+
const classSymbol = getParentOfSymbol(prototype);
|
|
53074
|
+
return getInstanceTypeOfClassSymbol(classSymbol);
|
|
53040
53075
|
}
|
|
53041
53076
|
function getTypeOfPropertyOfType(type, name) {
|
|
53042
53077
|
const prop = getPropertyOfType(type, name);
|
|
@@ -67480,8 +67515,8 @@ ${lanes.join("\n")}
|
|
|
67480
67515
|
if (symbol === void 0) {
|
|
67481
67516
|
return type;
|
|
67482
67517
|
}
|
|
67483
|
-
const classSymbol = symbol
|
|
67484
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67518
|
+
const classSymbol = getParentOfSymbol(symbol);
|
|
67519
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getInstanceTypeOfClassSymbol(classSymbol);
|
|
67485
67520
|
return getNarrowedType(
|
|
67486
67521
|
type,
|
|
67487
67522
|
targetType,
|
|
@@ -68932,7 +68967,7 @@ ${lanes.join("\n")}
|
|
|
68932
68967
|
return void 0;
|
|
68933
68968
|
}
|
|
68934
68969
|
}
|
|
68935
|
-
return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
68970
|
+
return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
68936
68971
|
}
|
|
68937
68972
|
case 1 /* ExportsProperty */:
|
|
68938
68973
|
case 6 /* Prototype */:
|
|
@@ -69830,7 +69865,7 @@ ${lanes.join("\n")}
|
|
|
69830
69865
|
const inConstContext = isConstContext(node);
|
|
69831
69866
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
69832
69867
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
69833
|
-
const enumTag = getJSDocEnumTag(node);
|
|
69868
|
+
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
69834
69869
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
69835
69870
|
let objectFlags = freshObjectLiteralFlag;
|
|
69836
69871
|
let patternWithComputedProperties = false;
|
|
@@ -74587,6 +74622,11 @@ ${lanes.join("\n")}
|
|
|
74587
74622
|
} else {
|
|
74588
74623
|
assignNonContextualParameterTypes(signature);
|
|
74589
74624
|
}
|
|
74625
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
74626
|
+
const inferenceContext = getInferenceContext(node);
|
|
74627
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
74628
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
74629
|
+
}
|
|
74590
74630
|
}
|
|
74591
74631
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
74592
74632
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -6689,6 +6689,7 @@ var Diagnostics = {
|
|
|
6689
6689
|
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."),
|
|
6690
6690
|
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'."),
|
|
6691
6691
|
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."),
|
|
6692
|
+
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."),
|
|
6692
6693
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
6693
6694
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
6694
6695
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -25897,6 +25898,16 @@ var commandOptionsWithoutBuild = [
|
|
|
25897
25898
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
25898
25899
|
defaultValueDescription: false
|
|
25899
25900
|
},
|
|
25901
|
+
{
|
|
25902
|
+
name: "strictInstanceOfTypeParameters",
|
|
25903
|
+
type: "boolean",
|
|
25904
|
+
affectsSemanticDiagnostics: true,
|
|
25905
|
+
affectsBuildInfo: true,
|
|
25906
|
+
strictFlag: true,
|
|
25907
|
+
category: Diagnostics.Type_Checking,
|
|
25908
|
+
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
25909
|
+
defaultValueDescription: false
|
|
25910
|
+
},
|
|
25900
25911
|
{
|
|
25901
25912
|
name: "alwaysStrict",
|
|
25902
25913
|
type: "boolean",
|
|
@@ -31585,24 +31596,21 @@ function installNpmPackages(npmPath, tsVersion, packageNames, install) {
|
|
|
31585
31596
|
for (let remaining = packageNames.length; remaining > 0; ) {
|
|
31586
31597
|
const result = getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remaining);
|
|
31587
31598
|
remaining = result.remaining;
|
|
31588
|
-
hasError = install(result.command
|
|
31599
|
+
hasError = install(result.command) || hasError;
|
|
31589
31600
|
}
|
|
31590
31601
|
return hasError;
|
|
31591
31602
|
}
|
|
31592
31603
|
function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remaining) {
|
|
31593
31604
|
const sliceStart = packageNames.length - remaining;
|
|
31594
|
-
let toSlice = remaining;
|
|
31595
|
-
let args;
|
|
31605
|
+
let command, toSlice = remaining;
|
|
31596
31606
|
while (true) {
|
|
31597
|
-
|
|
31598
|
-
|
|
31599
|
-
if (length2 < 8e3) {
|
|
31600
|
-
args = ["install", "--ignore-scripts", ...slice, "--save-dev", `--user-agent=typesInstaller/${tsVersion}`];
|
|
31607
|
+
command = `${npmPath} install --ignore-scripts ${(toSlice === packageNames.length ? packageNames : packageNames.slice(sliceStart, sliceStart + toSlice)).join(" ")} --save-dev --user-agent="typesInstaller/${tsVersion}"`;
|
|
31608
|
+
if (command.length < 8e3) {
|
|
31601
31609
|
break;
|
|
31602
31610
|
}
|
|
31603
31611
|
toSlice = toSlice - Math.floor(toSlice / 2);
|
|
31604
31612
|
}
|
|
31605
|
-
return { command
|
|
31613
|
+
return { command, remaining: remaining - toSlice };
|
|
31606
31614
|
}
|
|
31607
31615
|
function endsWith2(str, suffix, caseSensitive) {
|
|
31608
31616
|
const expectedPos = str.length - suffix.length;
|
|
@@ -32062,13 +32070,13 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
|
|
|
32062
32070
|
this.log.writeLine(`NPM location: ${this.npmPath} (explicit '${Arguments.NpmLocation}' ${npmLocation2 === void 0 ? "not " : ""} provided)`);
|
|
32063
32071
|
this.log.writeLine(`validateDefaultNpmLocation: ${validateDefaultNpmLocation2}`);
|
|
32064
32072
|
}
|
|
32065
|
-
({ execSync: this.
|
|
32073
|
+
({ execSync: this.nodeExecSync } = require("child_process"));
|
|
32066
32074
|
this.ensurePackageDirectoryExists(globalTypingsCacheLocation2);
|
|
32067
32075
|
try {
|
|
32068
32076
|
if (this.log.isEnabled()) {
|
|
32069
32077
|
this.log.writeLine(`Updating ${typesRegistryPackageName} npm package...`);
|
|
32070
32078
|
}
|
|
32071
|
-
this.
|
|
32079
|
+
this.execSyncAndLog(`${this.npmPath} install --ignore-scripts ${typesRegistryPackageName}@${this.latestDistTag}`, { cwd: globalTypingsCacheLocation2 });
|
|
32072
32080
|
if (this.log.isEnabled()) {
|
|
32073
32081
|
this.log.writeLine(`Updated ${typesRegistryPackageName} npm package`);
|
|
32074
32082
|
}
|
|
@@ -32139,19 +32147,19 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
|
|
|
32139
32147
|
this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(packageNames)}'.`);
|
|
32140
32148
|
}
|
|
32141
32149
|
const start = Date.now();
|
|
32142
|
-
const hasError = installNpmPackages(this.npmPath, version, packageNames, (command
|
|
32150
|
+
const hasError = installNpmPackages(this.npmPath, version, packageNames, (command) => this.execSyncAndLog(command, { cwd }));
|
|
32143
32151
|
if (this.log.isEnabled()) {
|
|
32144
32152
|
this.log.writeLine(`npm install #${requestId} took: ${Date.now() - start} ms`);
|
|
32145
32153
|
}
|
|
32146
32154
|
onRequestCompleted(!hasError);
|
|
32147
32155
|
}
|
|
32148
32156
|
/** Returns 'true' in case of error. */
|
|
32149
|
-
|
|
32157
|
+
execSyncAndLog(command, options) {
|
|
32150
32158
|
if (this.log.isEnabled()) {
|
|
32151
32159
|
this.log.writeLine(`Exec: ${command}`);
|
|
32152
32160
|
}
|
|
32153
32161
|
try {
|
|
32154
|
-
const stdout = this.
|
|
32162
|
+
const stdout = this.nodeExecSync(command, { ...options, encoding: "utf-8" });
|
|
32155
32163
|
if (this.log.isEnabled()) {
|
|
32156
32164
|
this.log.writeLine(` Succeeded. stdout:${indent(sys.newLine, stdout)}`);
|
|
32157
32165
|
}
|
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-53300-9",
|
|
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": "9d11a451a9b7cee2223e23f50f997867a03547ec"
|
|
118
118
|
}
|