Add --noStrictGenericChecks compiler option

This commit is contained in:
Anders Hejlsberg 2017-06-12 13:09:01 -07:00
parent d27f4d4f15
commit dc28aaa132
4 changed files with 13 additions and 1 deletions

View File

@ -9509,7 +9509,8 @@ namespace ts {
// in the context of the target signature before checking the relationship. Ideally we'd do
// this regardless of the number of signatures, but the potential costs are prohibitive due
// to the quadratic nature of the logic below.
result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], /*erase*/ relation === comparableRelation, reportErrors);
const eraseGenerics = relation === comparableRelation || compilerOptions.noStrictGenericChecks;
result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors);
}
else {
outer: for (const t of targetSignatures) {

View File

@ -620,6 +620,12 @@ namespace ts {
category: Diagnostics.Advanced_Options,
description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files
},
{
name: "noStrictGenericChecks",
type: "boolean",
category: Diagnostics.Advanced_Options,
description: Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
},
{
// A list of plugins to load in the language service
name: "plugins",

View File

@ -3278,6 +3278,10 @@
"category": "Message",
"code": 6184
},
"Disable strict checking of generic signatures in function types.": {
"category": "Message",
"code": 6185
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005

View File

@ -3522,6 +3522,7 @@ namespace ts {
noImplicitAny?: boolean; // Always combine with strict property
noImplicitReturns?: boolean;
noImplicitThis?: boolean; // Always combine with strict property
noStrictGenericChecks?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
noImplicitUseStrict?: boolean;