microsoft / microsoft/TypeScript

@see for property ref in __type__ reference

Open
#45,017 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: JSDoc Experimentation Needed Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Suggestion

🔍 Search Terms

jsdoc tsdoc @see @link docs types

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

📃 Motivating Example

export type A = {
  /**
   * The import ID from which the re-export was imported from.
   */
  foo: string
}

export namespace A {
  export type Params = {
    /**
     * @see {@link A['foo']}
     */
    foo: string
  }
  
  export const create = (params:Params): A => {
      return 'todo' as any
  }
}

Here is the above code (approx) in an interactive VSC setting, note the following:

  1. Want to navigate to type alias but it goes to namespace
  2. Want to point at a specific property, cannot

CleanShot 2021-07-13 at 19 44 06

I do not have a concrete suggestion yet about how to achieve this.

First want to validate the problem with others.

💻 Use Cases

Want to share the JSDoc between a property on a constructor and a data type.

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 motivating example in VS Code and compare how the JSDoc @see/@link reference to A['foo'] resolves against the namespace. Start by validating the reported navigation behavior and determining a concrete syntax or resolution rule; done requires an agreed approach for pointing at the specific property and sharing its documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.