File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -3913,9 +3913,14 @@ namespace ts.Completions {
39133913 if ( type ) {
39143914 return type ;
39153915 }
3916- if ( isBinaryExpression ( node . parent ) && node . parent . operatorToken . kind === SyntaxKind . EqualsToken && node === node . parent . left ) {
3916+ const parent = walkUpParenthesizedExpressions ( node . parent ) ;
3917+ if ( isBinaryExpression ( parent ) && parent . operatorToken . kind === SyntaxKind . EqualsToken && node === parent . left ) {
39173918 // Object literal is assignment pattern: ({ | } = x)
3918- return typeChecker . getTypeAtLocation ( node . parent ) ;
3919+ return typeChecker . getTypeAtLocation ( parent ) ;
3920+ }
3921+ if ( isExpression ( parent ) ) {
3922+ // f(() => (({ | })));
3923+ return typeChecker . getContextualType ( parent ) ;
39193924 }
39203925 return undefined ;
39213926 }
Original file line number Diff line number Diff line change 1+ /// <reference path='fourslash.ts'/>
2+
3+ ////type Foo = { foo: boolean };
4+ ////function f<T>(shape: Foo): any;
5+ ////function f<T>(shape: () => Foo): any;
6+ ////function f(arg: any) {
7+ //// return arg;
8+ //// }
9+ ////
10+ ////f({ /*1*/ });
11+ ////f(() => ({ /*2*/ }));
12+ ////f(() => (({ /*3*/ })));
13+
14+ verify . completions ( {
15+ marker : [ "1" , "2" , "3" ] ,
16+ exact : [ "foo" ]
17+ } ) ;
You can’t perform that action at this time.
0 commit comments