-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
CodeFix import for items that exist globally #13378
Comments
So is the idea here that this would always be an available "refactoring" or is this for the scenario you have in mind one where you actually meant to import your History component and simply forgot? |
@aluanhaddad what I meant was this. Imagine user has React component: // File: history1.tsx
export const History = ()=> <div>...</div> and he wants to reuse it in his other react components // File: test.tsx
export const Test = ()=> <History/> But because there happens to exist 'History' global variable - he is not able to use the most awesome recent feature of TS/Vscode called "CodeFix import" - no bulb and clicking Cmd+"." does nothing Now the only way to make it work is to manually go to the top of the file and add I was just wondering if it was make sense to have this logic: If there is no import like List of global types/items is pretty big but still not sure if it's gonna be common scenario of defining own things that happen to have the same name as some globals |
Thanks for clarifying. I like this idea. |
I'm not sure if this feature request is valid so just wanted to see what you think.
Let's say I have a react component called
History
.As it happens there also exists global
declare var History
inlib.dom.d.ts
It would be nice that when using
History
in my module I could use CodeFix import action (Cmd+.
) to be able to import my own component if there is no such local import. CodeFix bulb / shortcut keyboard is very discreet so there wouldn't be any worry of noise.And I'm not sure how many other such cases could exist
The text was updated successfully, but these errors were encountered: