question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript doc visible for aliased imports, but not for single ones.

See original GitHub issue

From @Elarcis on September 21, 2016 7:35

  • VSCode Version: 1.5.2
  • OS Version: Windows 7 Service Pack 1
  • Typescript version: 2.0.2

Steps to Reproduce:

  1. have a myClass.ts file exporting a MyClass class. Write some /** */ doc for that class.
  2. In another file, try the following two ways of importing identifiers:
import { MyClass } from 'myModule';
MyClass // When hovering MyClass, the written doc is not visible.
import * as myModule from 'myModule';
myModule.MyClass // When hovering MyClass, the written doc appears.

It seems logical that the doc should appear in both cases, is this due to Typescript 2?

Copied from original issue: Microsoft/vscode#12360

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:13
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
aluanhaddadcommented, Sep 24, 2016

This is currently a huge painpoint. Improving this would be a very big win.

3reactions
rozzzlycommented, Sep 25, 2016

I’d also like to point out that default imports don’t get the (js)doc for that export either.

import SomeDefaultExport from './FooBar';

Hovering over SomeDefaultExport in both the import declaration as well as it’s uses in code will just show “import SomeDefaultExport”.

I’m not at my desktop at the moment, so I haven’t tested this, but imagine the same problem would exist with imports like this:

import { Foo as Bar } from './FooBar';

I’ll update this post when I’m able to test that.

My experience with this bug are in typescript, but I would imagine there would be the issue with javascript (that uses es2015 imports). I’ll test that out too.

Edit

the same issues also appears with JavaScript. In addition, this syntax also has the same problem.

import { Foo as Bar } from './FooBar';
Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Modules - TypeScript
Modules are declarative; the relationships between modules are specified in terms of imports and exports at the file level. Modules import one another...
Read more >
Why does VSCode not pick up path aliases in tsconfig?
The tsconfig configuration will only apply to files matched by the "include" option and not excluded by the "exclude" option.
Read more >
Using TypeScript aliases in Cypress tests - Gleb Bahmutov
How to configure TypeScript and Webpack path aliases to load ... Start the app in one terminal with npm start and open Cypress...
Read more >
typescript-cheatsheet - GitHub Pages
declared in a module are not visible outside the module unless they are explicitly exported using one of the export forms. Conversely, to...
Read more >
TypeScript | WebStorm Documentation - JetBrains
WebStorm supports developing, running, and debugging TypeScript source code. ... If there is only one source to import the symbol from, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found