File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3010,18 +3010,24 @@ namespace ts {
30103010 function tryGetGlobalSymbols ( ) : boolean {
30113011 let objectLikeContainer = tryGetObjectLikeCompletionContainer ( contextToken ) ;
30123012 if ( objectLikeContainer ) {
3013- // Object literal expression, look up possible property names from contextual type
3013+ // We're looking up possible property names from contextual/inferred/declared type.
30143014 isMemberCompletion = true ;
3015- isNewIdentifierLocation = true ;
30163015
30173016 let typeForObject : Type ;
30183017 let existingMembers : Declaration [ ] ;
30193018
30203019 if ( objectLikeContainer . kind === SyntaxKind . ObjectLiteralExpression ) {
3020+ // We are completing on contextual types, but may also include properties
3021+ // other than those within the declared type.
3022+ isNewIdentifierLocation = true ;
3023+
30213024 typeForObject = typeChecker . getContextualType ( < ObjectLiteralExpression > objectLikeContainer ) ;
30223025 existingMembers = ( < ObjectLiteralExpression > objectLikeContainer ) . properties ;
30233026 }
30243027 else {
3028+ // We are *only* completing on properties from the type being destructured.
3029+ isNewIdentifierLocation = false ;
3030+
30253031 typeForObject = typeChecker . getTypeAtLocation ( objectLikeContainer ) ;
30263032 existingMembers = ( < BindingPattern > objectLikeContainer ) . elements ;
30273033 }
You can’t perform that action at this time.
0 commit comments