mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 11:54:44 -06:00
Addressed PR feedback
This commit is contained in:
parent
6cfa64daa3
commit
112e4b1e80
@ -3506,9 +3506,16 @@ namespace ts {
|
||||
// through type declaration or inference.
|
||||
// Also proceed if rootDeclaration is 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
|
||||
if (rootDeclaration.initializer ||
|
||||
rootDeclaration.type ||
|
||||
(rootDeclaration.kind === SyntaxKind.Parameter && isExpression(rootDeclaration.parent) && typeChecker.getContextualType(<Expression>rootDeclaration.parent))) {
|
||||
let canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
|
||||
if (!canGetType && rootDeclaration.kind === SyntaxKind.Parameter) {
|
||||
if (isExpression(rootDeclaration.parent)) {
|
||||
canGetType = !!typeChecker.getContextualType(<Expression>rootDeclaration.parent);
|
||||
}
|
||||
else if (rootDeclaration.parent.kind === SyntaxKind.MethodDeclaration || rootDeclaration.parent.kind === SyntaxKind.SetAccessor) {
|
||||
canGetType = isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(<Expression>rootDeclaration.parent.parent);
|
||||
}
|
||||
}
|
||||
if (canGetType) {
|
||||
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
|
||||
existingMembers = (<BindingPattern>objectLikeContainer).elements;
|
||||
}
|
||||
|
||||
@ -6,10 +6,30 @@
|
||||
|
||||
////[<I>null].reduce(({/*2*/}, b) => b);
|
||||
|
||||
////interface Foo {
|
||||
//// m(x: { x1: number, x2: number }): void;
|
||||
//// prop: I;
|
||||
////}
|
||||
////let x: Foo = {
|
||||
//// m({ /*3*/ }) {
|
||||
//// },
|
||||
//// get prop(): I { return undefined; },
|
||||
//// set prop({ /*4*/ }) {
|
||||
//// }
|
||||
////};
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("x1");
|
||||
verify.completionListContains("x2");
|
||||
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("x1");
|
||||
verify.completionListContains("x2");
|
||||
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("x1");
|
||||
verify.completionListContains("x2");
|
||||
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("x1");
|
||||
verify.completionListContains("x2");
|
||||
Loading…
x
Reference in New Issue
Block a user