Don't use property symbols from contextual types with binding patterns for quick info
This commit is contained in:
Родитель
2149a0f31a
Коммит
49596d7158
|
@ -3560,7 +3560,7 @@ function getSymbolAtLocationForQuickInfo(node: Node, checker: TypeChecker): Symb
|
|||
const object = getContainingObjectLiteralElement(node);
|
||||
if (object) {
|
||||
const contextualType = checker.getContextualType(object.parent);
|
||||
const properties = contextualType && getPropertySymbolsFromContextualType(object, checker, contextualType, /*unionSymbolOk*/ false);
|
||||
const properties = contextualType && !contextualType.pattern && getPropertySymbolsFromContextualType(object, checker, contextualType, /*unionSymbolOk*/ false);
|
||||
if (properties && properties.length === 1) {
|
||||
return first(properties);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @strict: true
|
||||
|
||||
//// const { x } = { x/*1*/: 1 };
|
||||
//// const { x: y } = { x/*2*/: 1 };
|
||||
////
|
||||
//// type Foo = {
|
||||
//// /** awesome prop */
|
||||
//// x: number;
|
||||
//// };
|
||||
//// const { x: z }: Foo = { x/*3*/: 1 };
|
||||
|
||||
verify.quickInfoAt("1", "(property) x: number");
|
||||
verify.quickInfoAt("2", "(property) x: number");
|
||||
verify.quickInfoAt("3", "(property) x: number", "awesome prop");
|
Загрузка…
Ссылка в новой задаче