microsoft / microsoft/TypeScript

JSDoc multi-line properties within Array<Object> syntax parse differently than Object[]

Open
#30,965 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: JSDoc
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.5.0-dev.20190416

Search Terms:
JSDoc @type @param @arg multi-line type literal Array<>

Code

/**
 * @param {Array<Object>} os - has a string and a number
 * @param {string} os[].s - the string
 * @param {number} os[].n - the number
 */
function f(os) { return os[0].s; }

Expected behavior:

It appears that #17352 implemented this correctly for when the first @param is @param {Object[]} but failed to consider the other syntax to write this in JSDoc: @param {Array<Object>}.

For ease of debugging I am looking at the output of Intellisense when hovering over os in the function. I'd expect the output to look as iti does when @param {Object[]} is used:
image

Actual behavior:
image

Playground Link:
Playground Link

Related Issues:
#11597

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

Start with the linked Playground reproduction and compare the hover information for Array<Object> with the equivalent Object[] syntax. Read the behavior described in #17352 and compare the related issue #11597; done means both forms produce the same multi-line property information for os.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.