File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3010,18 +3010,24 @@ namespace ts {
3010
3010
function tryGetGlobalSymbols ( ) : boolean {
3011
3011
let objectLikeContainer = tryGetObjectLikeCompletionContainer ( contextToken ) ;
3012
3012
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.
3014
3014
isMemberCompletion = true ;
3015
- isNewIdentifierLocation = true ;
3016
3015
3017
3016
let typeForObject : Type ;
3018
3017
let existingMembers : Declaration [ ] ;
3019
3018
3020
3019
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
+
3021
3024
typeForObject = typeChecker . getContextualType ( < ObjectLiteralExpression > objectLikeContainer ) ;
3022
3025
existingMembers = ( < ObjectLiteralExpression > objectLikeContainer ) . properties ;
3023
3026
}
3024
3027
else {
3028
+ // We are *only* completing on properties from the type being destructured.
3029
+ isNewIdentifierLocation = false ;
3030
+
3025
3031
typeForObject = typeChecker . getTypeAtLocation ( objectLikeContainer ) ;
3026
3032
existingMembers = ( < BindingPattern > objectLikeContainer ) . elements ;
3027
3033
}
You can’t perform that action at this time.
0 commit comments