mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Mark IIFE signature with anySignature during contextual typing
Avoids recursion -- during batch compilation, `checkCallExpression` already sets the signature to `anySignature` as a sentinel value, the services layer calls directly into `checkParameter`, skipping `checkCallExpression` entirely. So `getContextuallyTypedParameterType` also needs to set this sentinel value.
This commit is contained in:
parent
c9ab20c13b
commit
8e668441b3
@ -8606,7 +8606,12 @@ namespace ts {
|
||||
}
|
||||
return createArrayType(getUnionType(restTypes));
|
||||
}
|
||||
return checkExpression(iife.arguments[indexOfParameter]);
|
||||
const links = getNodeLinks(iife);
|
||||
const cached = links.resolvedSignature;
|
||||
links.resolvedSignature = anySignature;
|
||||
const type = checkExpression(iife.arguments[indexOfParameter]);
|
||||
links.resolvedSignature = cached;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
const contextualSignature = getContextualSignature(func);
|
||||
|
||||
38
tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts
Normal file
38
tests/cases/fourslash/quickInfoForContextuallyTypedIife.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////(({ q/*1*/, qq/*2*/ }, x/*3*/, { p/*4*/ }) => {
|
||||
//// var s: number = q/*5*/;
|
||||
//// var t: number = qq/*6*/;
|
||||
//// var u: number = p/*7*/;
|
||||
//// var v: number = x/*8*/;
|
||||
//// return q; })({ q: 13, qq: 12 }, 1, { p: 14 });
|
||||
////((a/*9*/, b/*10*/, c/*11*/) => [a/*12*/,b/*13*/,c/*14*/])("foo", 101, false);
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("var q: number");
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs("var qq: number");
|
||||
goTo.marker('3');
|
||||
verify.quickInfoIs("(parameter) x: number");
|
||||
goTo.marker('4');
|
||||
verify.quickInfoIs("var p: number");
|
||||
goTo.marker('5');
|
||||
verify.quickInfoIs("var q: number");
|
||||
goTo.marker('6');
|
||||
verify.quickInfoIs("var qq: number");
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("var p: number");
|
||||
goTo.marker('8');
|
||||
verify.quickInfoIs("(parameter) x: number");
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs("(parameter) a: string");
|
||||
goTo.marker('10');
|
||||
verify.quickInfoIs("(parameter) b: number");
|
||||
goTo.marker('11');
|
||||
verify.quickInfoIs("(parameter) c: boolean");
|
||||
goTo.marker('12');
|
||||
verify.quickInfoIs("(parameter) a: string");
|
||||
goTo.marker('13');
|
||||
verify.quickInfoIs("(parameter) b: number");
|
||||
goTo.marker('14');
|
||||
verify.quickInfoIs("(parameter) c: boolean");
|
||||
Loading…
x
Reference in New Issue
Block a user