mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 07:45:18 -06:00
fix(53424): in code documentation is not working upon import if function expression reuse function type (#53964)
This commit is contained in:
parent
6947c98929
commit
320e628a6d
@ -535,12 +535,12 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: Typ
|
||||
// don't use symbolFlags since getAliasedSymbol requires the flag on the symbol itself
|
||||
if (symbol.flags & SymbolFlags.Alias) {
|
||||
prefixNextMeaning();
|
||||
if (!hasAddedSymbolInfo) {
|
||||
if (!hasAddedSymbolInfo || documentation.length === 0 && tags.length === 0) {
|
||||
const resolvedSymbol = typeChecker.getAliasedSymbol(symbol);
|
||||
if (resolvedSymbol !== symbol && resolvedSymbol.declarations && resolvedSymbol.declarations.length > 0) {
|
||||
const resolvedNode = resolvedSymbol.declarations[0];
|
||||
const declarationName = getNameOfDeclaration(resolvedNode);
|
||||
if (declarationName) {
|
||||
if (declarationName && !hasAddedSymbolInfo) {
|
||||
const isExternalModuleDeclaration =
|
||||
isModuleWithStringLiteralName(resolvedNode) &&
|
||||
hasSyntacticModifier(resolvedNode, ModifierFlags.Ambient);
|
||||
@ -835,7 +835,6 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: Typ
|
||||
documentation = allSignatures[0].getDocumentationComment(typeChecker);
|
||||
tags = allSignatures[0].getJsDocTags().filter(tag => tag.name !== "deprecated"); // should only include @deprecated JSDoc tag on the first overload (#49368)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node | undefined) {
|
||||
|
||||
91
tests/baselines/reference/quickInfoJsDocAlias.baseline
Normal file
91
tests/baselines/reference/quickInfoJsDocAlias.baseline
Normal file
@ -0,0 +1,91 @@
|
||||
=== /b.ts ===
|
||||
// import { A } from "./a";
|
||||
// A()
|
||||
// ^
|
||||
// | ----------------------------------------------------------------------
|
||||
// | (alias) A(): void
|
||||
// | import A
|
||||
// | docs - const A: T
|
||||
// | ----------------------------------------------------------------------
|
||||
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/b.ts",
|
||||
"position": 26,
|
||||
"name": ""
|
||||
},
|
||||
"item": {
|
||||
"kind": "alias",
|
||||
"kindModifiers": "export,declare",
|
||||
"textSpan": {
|
||||
"start": 25,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "alias",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "A",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "void",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "lineBreak"
|
||||
},
|
||||
{
|
||||
"text": "import",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "A",
|
||||
"kind": "aliasName"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
{
|
||||
"text": "docs - const A: T",
|
||||
"kind": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
15
tests/cases/fourslash/quickInfoJsDocAlias.ts
Normal file
15
tests/cases/fourslash/quickInfoJsDocAlias.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @filename: /a.d.ts
|
||||
/////** docs - type T */
|
||||
////export type T = () => void;
|
||||
/////**
|
||||
//// * docs - const A: T
|
||||
//// */
|
||||
////export declare const A: T;
|
||||
|
||||
// @filename: /b.ts
|
||||
////import { A } from "./a";
|
||||
////A/**/()
|
||||
|
||||
verify.baselineQuickInfo();
|
||||
Loading…
x
Reference in New Issue
Block a user