diff --git a/src/services/services.ts b/src/services/services.ts index afb6a10869175..c46a6a3f40976 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -649,9 +649,8 @@ namespace ts { const isStaticMember = hasStaticModifier(declaration); return firstDefined(getAllSuperTypeNodes(classOrInterfaceDeclaration), superTypeNode => { const baseType = checker.getTypeAtLocation(superTypeNode); - const symbol = isStaticMember - ? find(checker.getExportsOfModule(baseType.symbol), s => s.escapedName === declaration.symbol.name) - : checker.getPropertyOfType(baseType, declaration.symbol.name); + const type = isStaticMember && baseType.symbol ? checker.getTypeOfSymbol(baseType.symbol) : baseType; + const symbol = checker.getPropertyOfType(type, declaration.symbol.name); return symbol ? cb(symbol) : undefined; }); } diff --git a/tests/baselines/reference/quickInfoInheritDoc4.baseline b/tests/baselines/reference/quickInfoInheritDoc4.baseline new file mode 100644 index 0000000000000..76e64f647d066 --- /dev/null +++ b/tests/baselines/reference/quickInfoInheritDoc4.baseline @@ -0,0 +1,73 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoInheritDoc4.ts", + "position": 79, + "name": "" + }, + "quickInfo": { + "kind": "method", + "kindModifiers": "static", + "textSpan": { + "start": 79, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "inheritdoc" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoInheritDoc5.baseline b/tests/baselines/reference/quickInfoInheritDoc5.baseline new file mode 100644 index 0000000000000..09bc74d1e86a3 --- /dev/null +++ b/tests/baselines/reference/quickInfoInheritDoc5.baseline @@ -0,0 +1,73 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoInheritDoc5.js", + "position": 83, + "name": "" + }, + "quickInfo": { + "kind": "method", + "kindModifiers": "static", + "textSpan": { + "start": 83, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "inheritdoc" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoInheritDoc6.baseline b/tests/baselines/reference/quickInfoInheritDoc6.baseline new file mode 100644 index 0000000000000..c23fd104f01ff --- /dev/null +++ b/tests/baselines/reference/quickInfoInheritDoc6.baseline @@ -0,0 +1,73 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoInheritDoc6.js", + "position": 107, + "name": "" + }, + "quickInfo": { + "kind": "method", + "kindModifiers": "static", + "textSpan": { + "start": 107, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "inheritdoc" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoInheritDoc4.ts b/tests/cases/fourslash/quickInfoInheritDoc4.ts new file mode 100644 index 0000000000000..70287075429b7 --- /dev/null +++ b/tests/cases/fourslash/quickInfoInheritDoc4.ts @@ -0,0 +1,15 @@ +/// + +// @Filename: quickInfoInheritDoc4.ts +////var A: any; +//// +////class B extends A { +//// /** +//// * @inheritdoc +//// */ +//// static /**/value() { +//// return undefined; +//// } +////} + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/quickInfoInheritDoc5.ts b/tests/cases/fourslash/quickInfoInheritDoc5.ts new file mode 100644 index 0000000000000..9790a74712dae --- /dev/null +++ b/tests/cases/fourslash/quickInfoInheritDoc5.ts @@ -0,0 +1,18 @@ +/// + +// @allowJs: true +// @checkJs: true + +// @Filename: quickInfoInheritDoc5.js +////function A() {} +//// +////class B extends A { +//// /** +//// * @inheritdoc +//// */ +//// static /**/value() { +//// return undefined; +//// } +////} + +verify.baselineQuickInfo(); diff --git a/tests/cases/fourslash/quickInfoInheritDoc6.ts b/tests/cases/fourslash/quickInfoInheritDoc6.ts new file mode 100644 index 0000000000000..eb7deca9523b6 --- /dev/null +++ b/tests/cases/fourslash/quickInfoInheritDoc6.ts @@ -0,0 +1,16 @@ +/// + +// @allowJs: true +// @checkJs: true + +// @Filename: quickInfoInheritDoc6.js +////class B extends UNRESOLVED_VALUE_DEFINITELY_DOES_NOT_EXIST { +//// /** +//// * @inheritdoc +//// */ +//// static /**/value() { +//// return undefined; +//// } +////} + +verify.baselineQuickInfo();