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

Created on 23 Sep 2016  路  7Comments  路  Source: microsoft/TypeScript

_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_

Bug VS Code Tracked help wanted

Most helpful comment

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

All 7 comments

_From @chrmarti on September 21, 2016 16:42_

Can reproduce with the given example and TypeScript 1.8 in todays insider build.

Repro'd with latest TypeScript release bits - release-2.0.5 branch.

Here is code to copy and paste.

test.ts

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.

myModule.ts

/**
 * Some documentation
 */
export class MyClass {

}

sending to TypeScript language service repo.

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

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';

I've lost quite some time thinking I was doing type exports / imports wrong due to not seeing the docs on hover. 馃槄

What's the status on this? Waiting for someone from the community to work on it?

I'm the one who reported https://github.com/Microsoft/vscode/issues/28753. You can see the repro easily there.

This _seems_ like something basic that should just work, especially considering that props work fine (and that seems like it'd be harder to support). :D But anyways, please fix/include the class/component-level docs inclusion soon!

Is this a duplicate of #5515?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blendsdk picture blendsdk  路  3Comments

kyasbal-1994 picture kyasbal-1994  路  3Comments

remojansen picture remojansen  路  3Comments

bgrieder picture bgrieder  路  3Comments

jbondc picture jbondc  路  3Comments