Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent QuickInfo on type-only imported symbols #47134

Closed
lowr opened this issue Dec 13, 2021 · 3 comments · Fixed by #47138
Closed

Inconsistent QuickInfo on type-only imported symbols #47134

lowr opened this issue Dec 13, 2021 · 3 comments · Fixed by #47138
Labels
Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. Help Wanted You can do this
Milestone

Comments

@lowr
Copy link
Contributor

lowr commented Dec 13, 2021

Bug Report

🔎 Search Terms

type-only import quickinfo modifier specifier

🕗 Version & Regression Information

  • I was unable to test this on prior versions because the type modifier on import names had only been introduced in the latest version.

⏯ Playground Link

bug workbench

💻 Code

// @filename: lib.ts
export type A = number;
export type B = number;
export const A = 42;
export const B = 42;

// @filename: main.ts
import type { A } from "./lib";
import { type B } from "./lib";

🙁 Actual behavior

Hovering on A in the import statement gives you:

(alias) type A = string
import A

🙂 Expected behavior

Hovering on A gives you:

(alias) type A = string
(alias) const A: 42
import A

like hovering on B does, because you can use A as a value as long as it's in type contexts.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. labels Dec 13, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 13, 2021
@RyanCavanaugh RyanCavanaugh removed Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. labels Dec 13, 2021
@RyanCavanaugh RyanCavanaugh removed this from the Backlog milestone Dec 13, 2021
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. labels Dec 13, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 13, 2021
@RyanCavanaugh RyanCavanaugh added the Help Wanted You can do this label Dec 13, 2021
@lowr
Copy link
Contributor Author

lowr commented Dec 14, 2021

On a second thought, this may be the other way around, that is, QuickInfo on A should actually give you alias for both type and value. Am I right that TypeScript lets you import with type modifier and use values as long as they are in type contexts?

reference: #40583 (comment)

@RyanCavanaugh Sorry to bother you, but could you re-triage this issue?

@RyanCavanaugh
Copy link
Member

Am I right that TypeScript lets you import with type modifier and use values as long as they are in type contexts?

Correct.

I don't have a strong opinion either way on how these should display, but since they mean the same thing they should display the same way.

@lowr
Copy link
Contributor Author

lowr commented Dec 14, 2021

Thanks, I've updated the bug report accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Quick Info e.g. hover text, tool-tips, and tooltips. Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants