From 1e41af30fee7fbdb1b7e2bb1130ae183abd0a7ab Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 25 May 2016 12:27:29 -0700 Subject: [PATCH] Update LKG --- lib/tsc.js | 2 +- lib/tsserver.js | 2 +- lib/tsserverlibrary.js | 2 +- lib/typescript.js | 9 ++++----- lib/typescriptServices.js | 9 ++++----- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 00c758c0446..ca303c49f7b 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -18090,7 +18090,7 @@ var ts; inferFromTypes(source, t); } } - if (target.flags & 16384 && typeParameterCount === 1) { + if (typeParameterCount === 1) { inferiority++; inferFromTypes(source, typeParameter); inferiority--; diff --git a/lib/tsserver.js b/lib/tsserver.js index 7eb744a77d3..dcf76693225 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -18854,7 +18854,7 @@ var ts; inferFromTypes(source, t); } } - if (target.flags & 16384 && typeParameterCount === 1) { + if (typeParameterCount === 1) { inferiority++; inferFromTypes(source, typeParameter); inferiority--; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 902bfcf610e..f16d02e472c 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -18854,7 +18854,7 @@ var ts; inferFromTypes(source, t); } } - if (target.flags & 16384 && typeParameterCount === 1) { + if (typeParameterCount === 1) { inferiority++; inferFromTypes(source, typeParameter); inferiority--; diff --git a/lib/typescript.js b/lib/typescript.js index 19fffd35501..cf982a3ede9 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -21958,11 +21958,10 @@ var ts; inferFromTypes(source, t); } } - // Next, if target is a union type containing a single naked type parameter, make a - // secondary inference to that type parameter. We don't do this for intersection types - // because in a target type like Foo & T we don't know how which parts of the source type - // should be matched by Foo and which should be inferred to T. - if (target.flags & 16384 /* Union */ && typeParameterCount === 1) { + // Next, if target containings a single naked type parameter, make a secondary inference to that type + // parameter. This gives meaningful results for union types in co-variant positions and intersection + // types in contra-variant positions (such as callback parameters). + if (typeParameterCount === 1) { inferiority++; inferFromTypes(source, typeParameter); inferiority--; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 19fffd35501..cf982a3ede9 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -21958,11 +21958,10 @@ var ts; inferFromTypes(source, t); } } - // Next, if target is a union type containing a single naked type parameter, make a - // secondary inference to that type parameter. We don't do this for intersection types - // because in a target type like Foo & T we don't know how which parts of the source type - // should be matched by Foo and which should be inferred to T. - if (target.flags & 16384 /* Union */ && typeParameterCount === 1) { + // Next, if target containings a single naked type parameter, make a secondary inference to that type + // parameter. This gives meaningful results for union types in co-variant positions and intersection + // types in contra-variant positions (such as callback parameters). + if (typeParameterCount === 1) { inferiority++; inferFromTypes(source, typeParameter); inferiority--;