mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix(46998): Hover on as const shows type const = /*unresolved*/ any (#47000)
This commit is contained in:
parent
1fe9bfdd0e
commit
4761ba6285
@ -330,7 +330,7 @@ namespace ts.SymbolDisplay {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
addRange(displayParts, typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, TypeFormatFlags.InTypeAlias));
|
||||
addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, TypeFormatFlags.InTypeAlias));
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Enum) {
|
||||
prefixNextMeaning();
|
||||
|
||||
258
tests/baselines/reference/quickInfoForConstAssertions.baseline
Normal file
258
tests/baselines/reference/quickInfoForConstAssertions.baseline
Normal file
@ -0,0 +1,258 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoForConstAssertions.ts",
|
||||
"position": 22,
|
||||
"name": "1"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "type",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 22,
|
||||
"length": 5
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "type",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "const",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "=",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "{",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "lineBreak"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "readonly",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "propertyName"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "1",
|
||||
"kind": "stringLiteral"
|
||||
},
|
||||
{
|
||||
"text": ";",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "lineBreak"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "punctuation"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoForConstAssertions.ts",
|
||||
"position": 44,
|
||||
"name": "2"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "type",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 44,
|
||||
"length": 5
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "type",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "const",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "=",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "1",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoForConstAssertions.ts",
|
||||
"position": 68,
|
||||
"name": "3"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "type",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 68,
|
||||
"length": 5
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "type",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "const",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "=",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "\"c\"",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoForConstAssertions.ts",
|
||||
"position": 95,
|
||||
"name": "4"
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "type",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 95,
|
||||
"length": 5
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "type",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "const",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "=",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "readonly",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "[",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "1",
|
||||
"kind": "stringLiteral"
|
||||
},
|
||||
{
|
||||
"text": ",",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "2",
|
||||
"kind": "stringLiteral"
|
||||
},
|
||||
{
|
||||
"text": "]",
|
||||
"kind": "punctuation"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
}
|
||||
]
|
||||
8
tests/cases/fourslash/quickInfoForConstAssertions.ts
Normal file
8
tests/cases/fourslash/quickInfoForConstAssertions.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////const a = { a: 1 } as /*1*/const;
|
||||
////const b = 1 as /*2*/const;
|
||||
////const c = "c" as /*3*/const;
|
||||
////const d = [1, 2] as /*4*/const;
|
||||
|
||||
verify.baselineQuickInfo();
|
||||
Loading…
x
Reference in New Issue
Block a user