You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When implements interface in typescript adds import before element #28165
Clone the vscode-60606-repro branch, open src/pub/pub_task_provider.ts and then use the quick-fix to implement the interface. I changed it to typescript@latest and see the same issue.
(using * as vs in the import correctly puts vs. prefixes instead of import calls).
That code is technically equivalent to the version where an import statement is used, just not as pretty - hence why this hasn't been the highest priority for us, and why I said we'd take a PR to fix it~ ❤️
You'd want to query for the same type nodes that we do today (complete with import types), but then traverse the node tree looking for instances of ImportTypeNodes, and transform them into a normal type reference by replacing the import(...) part with a generated name, and then adding an import * as generatedName from "..." statement. Then you can get smarter, like using named imports rather than namespace, and merging with existing import statements where possible.
This was fixed by #36615 which is included in TypeScript 3.8.
Unfortunately, #34995, the issue I was assigned, was never marked as a duplicate of this one, and so I was never aware of the existence of this issue or the great work by Kento Lauzon (@keotl) at #33126. Sadly this happens from time to time in a repo with thousands of issues, but my apologies for the mixup nonetheless, particularly to Kento Lauzon (@keotl).
Activity
mjbvz commentedon Oct 26, 2018
Please try upgrading your workspace to use
typescript@nextby following these instructions. Do you still see this error after upgrading?mjbvz commentedon Oct 26, 2018
From Michal Diviš (@inferius) on October 12, 2018 7:28
Yes, i still see this error after upgrading.
mjbvz commentedon Oct 26, 2018
Thanks for testing. Can you please share your tsconfig and a basic description of your project structure
mjbvz commentedon Oct 26, 2018
From Danny Tuppeny (@DanTup) on October 23, 2018 9:3
Matt Bierner (@mjbvz) I see this too. I've pushed a branch with a repro here:
https://github.com/Dart-Code/Dart-Code/tree/vscode-60606-repro
Clone the
vscode-60606-reprobranch, opensrc/pub/pub_task_provider.tsand then use the quick-fix to implement the interface. I changed it totypescript@latestand see the same issue.(using
* as vsin the import correctly putsvs.prefixes instead of import calls).3 remaining items
MeirionHughes commentedon May 9, 2019
Any update on this? just seems to have been kicked into the long grass.
weswigham commentedon May 9, 2019
We'd probably take PRs to fix it ❤️
mjbates7 commentedon Aug 22, 2019
Still occurring - running insiders 1.38.0 build. Any updates or thoughts? It's generating code like this: (angular)
weswigham commentedon Aug 23, 2019
That code is technically equivalent to the version where an import statement is used, just not as pretty - hence why this hasn't been the highest priority for us, and why I said we'd take a PR to fix it~ ❤️
keotl commentedon Aug 28, 2019
I opened a PR which forces private aliases for implemented interface types. However, pointers would be appreciated for adding automatic importation.
weswigham commentedon Aug 28, 2019
You'd want to query for the same type nodes that we do today (complete with import types), but then traverse the node tree looking for instances of
ImportTypeNodes, and transform them into a normal type reference by replacing theimport(...)part with a generated name, and then adding animport * as generatedName from "..."statement. Then you can get smarter, like using named imports rather than namespace, and merging with existing import statements where possible.keotl commentedon Aug 30, 2019
I pushed a new version with automatic imports.

This would be ready for review/testing.
JulianLang commentedon Nov 8, 2019
So, what's the status here?
avol-io commentedon Mar 2, 2020
any news?
andrewbranch commentedon Mar 9, 2020
This was fixed by #36615 which is included in TypeScript 3.8.
Unfortunately, #34995, the issue I was assigned, was never marked as a duplicate of this one, and so I was never aware of the existence of this issue or the great work by Kento Lauzon (@keotl) at #33126. Sadly this happens from time to time in a repo with thousands of issues, but my apologies for the mixup nonetheless, particularly to Kento Lauzon (@keotl).