docs/libs/typescript.js
function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {
                // We're looking up possible property names from contextual/inferred/declared type.
                isMemberCompletion = true;
                var typeForObject;
                var existingMembers;
                if (objectLikeContainer.kind === 171 /* ObjectLiteralExpression */) {
                    // We are completing on contextual types, but may also include properties
                    // other than those within the declared type.
                    isNewIdentifierLocation = true;
                    // If the object literal is being assigned to something of type 'null | { hello: string }',
                    // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.
                    typeForObject = typeChecker.getContextualType(objectLikeContainer);
                    typeForObject = typeForObject && typeForObject.getNonNullableType();
                    existingMembers = objectLikeContainer.properties;
                }
                else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) {
                    // We are *only* completing on properties from the type being destructured.
                    isNewIdentifierLocation = false;
                    var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
                    if (ts.isVariableLike(rootDeclaration)) {
                        // We don't want to complete using the type acquired by the shape
                        // of the binding pattern; we are only interested in types acquired
                        // through type declaration or inference.
                        // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
                        // type of parameter will flow in from the contextual type of the function
                        var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
                        if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) {
                            if (ts.isExpression(rootDeclaration.parent)) {
                                canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
                            }
                            else if (rootDeclaration.parent.kind === 147 /* MethodDeclaration */ || rootDeclaration.parent.kind === 150 /* SetAccessor */) {
                                canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
                            }
                        }
                        if (canGetType) {
                            typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
                            existingMembers = objectLikeContainer.elements;
                        }
                    }
                    else {
                        ts.Debug.fail("Root declaration is not variable-like.");
                    }
                }
                else {
                    ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
                }
                if (!typeForObject) {
                    return false;
                }
                var typeMembers = typeChecker.getPropertiesOfType(typeForObject);
                if (typeMembers && typeMembers.length > 0) {
                    // Add filtered items to the completion list
                    symbols = filterObjectMembersList(typeMembers, existingMembers);
                }
                return true;
            }
function tryGetObjectLikeCompletionSymbols(objectLikeContainer) {
                // We're looking up possible property names from contextual/inferred/declared type.
                isMemberCompletion = true;
                var typeForObject;
                var existingMembers;
                if (objectLikeContainer.kind === 171 /* ObjectLiteralExpression */) {
                    // We are completing on contextual types, but may also include properties
                    // other than those within the declared type.
                    isNewIdentifierLocation = true;
                    // If the object literal is being assigned to something of type 'null | { hello: string }',
                    // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible.
                    typeForObject = typeChecker.getContextualType(objectLikeContainer);
                    typeForObject = typeForObject && typeForObject.getNonNullableType();
                    existingMembers = objectLikeContainer.properties;
                }
                else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) {
                    // We are *only* completing on properties from the type being destructured.
                    isNewIdentifierLocation = false;
                    var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
                    if (ts.isVariableLike(rootDeclaration)) {
                        // We don't want to complete using the type acquired by the shape
                        // of the binding pattern; we are only interested in types acquired
                        // through type declaration or inference.
                        // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
                        // type of parameter will flow in from the contextual type of the function
                        var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
                        if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) {
                            if (ts.isExpression(rootDeclaration.parent)) {
                                canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
                            }
                            else if (rootDeclaration.parent.kind === 147 /* MethodDeclaration */ || rootDeclaration.parent.kind === 150 /* SetAccessor */) {
                                canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
                            }
                        }
                        if (canGetType) {
                            typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
                            existingMembers = objectLikeContainer.elements;
                        }
                    }
                    else {
                        ts.Debug.fail("Root declaration is not variable-like.");
                    }
                }
                else {
                    ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
                }
                if (!typeForObject) {
                    return false;
                }
                var typeMembers = typeChecker.getPropertiesOfType(typeForObject);
                if (typeMembers && typeMembers.length > 0) {
                    // Add filtered items to the completion list
                    symbols = filterObjectMembersList(typeMembers, existingMembers);
                }
                return true;
            }
function tryGetObjectLikeCompletionSymbols ( objectLikeContainer ) { // We're looking up possible property names from contextual/inferred/declared type. isMemberCompletion = true ; var typeForObject ; var existingMembers ; if ( objectLikeContainer . kind === 171 /* ObjectLiteralExpression */ ) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true ; // If the object literal is being assigned to something of type 'null | { hello: string }', // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible. typeForObject = typeChecker . getContextualType ( objectLikeContainer ) ; typeForObject = typeForObject && typeForObject . getNonNullableType ( ) ; existingMembers = objectLikeContainer . properties ; } else if ( objectLikeContainer . kind === 167 /* ObjectBindingPattern */ ) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false ; var rootDeclaration = ts . getRootDeclaration ( objectLikeContainer . parent ) ; if ( ts . isVariableLike ( rootDeclaration ) ) { // We don't want to complete using the type acquired by the shape // of the binding pattern; we are only interested in types acquired // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function var canGetType = ! ! ( rootDeclaration . initializer || rootDeclaration . type ) ; if ( ! canGetType && rootDeclaration . kind === 142 /* Parameter */ ) { if ( ts . isExpression ( rootDeclaration . parent ) ) { canGetType = ! ! typeChecker . getContextualType ( rootDeclaration . parent ) ; } else if ( rootDeclaration . parent . kind === 147 /* MethodDeclaration */ || rootDeclaration . parent . kind === 150 /* SetAccessor */ ) { canGetType = ts . isExpression ( rootDeclaration . parent . parent ) && ! ! typeChecker . getContextualType ( rootDeclaration . parent . parent ) ; } } if ( canGetType ) { typeForObject = typeChecker . getTypeAtLocation ( objectLikeContainer ) ; existingMembers = objectLikeContainer . elements ; } } else { ts . Debug . fail ( "Root declaration is not variable-like." ) ; } } else { ts . Debug . fail ( "Expected object literal or binding pattern, got " + objectLikeContainer . kind ) ; } if ( ! typeForObject ) { return false ; } var typeMembers = typeChecker . getPropertiesOfType ( typeForObject ) ; if ( typeMembers && typeMembers . length > 0 ) { // Add filtered items to the completion list symbols = filterObjectMembersList ( typeMembers , existingMembers ) ; } return true ; }
Aggregates relevant symbols for completion in object literals and object binding patterns.
Relevant symbols are stored in the captured 'symbols' variable.

@returns true if 'symbols' was successfully populated; false otherwise.
Aggregates relevant symbols for completion in object literals and object binding patterns . Relevant symbols are stored in the captured symbols variable .