microsoft / microsoft/TypeScript

Show all JSDoc @typedef properties when forming object of that type

Open
#41,171 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Issue Type: Feature Request

Problem

When making references to custom types, you cannot really see what that custom type actually is actually composed of.

For example, I have a class called OnlineUser which takes an optional parameter of custom type OnlineUserOptions:

image

When hovering over a reference to the class or forming the object to pass as OnlineUserOptions, only the name of the type is shown in the documentation that is displayed. If you don't know/remember what properties comprise OnlineUserOptions, then the only way to find out is by beginning to type random characters:

image

Suggestion

It would be very useful if instead, as soon as you begin the object literal, it would show all the properties of the custom type, like so:

image

It would also be nice if it was possible to click on the name of the type to jump to its definition (maybe through use of the @link tag?) or hover over it to view its details as though you were hovering over its name in the actual @typedef.

VS Code version: Code 1.50.0 (93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3, 2020-10-07T06:10:52.432Z)
OS version: Windows_NT x64 10.0.19041

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in VS Code using a JSDoc @typedef such as OnlineUserOptions and an object literal passed to that type. Inspect the TypeScript language-service completion and documentation behavior involved; done means all typedef properties appear when forming the object and the type can provide useful navigation or hover details.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.