Skip to content

JS Doc @param Object Bug #23221

Closed
Closed
@mjbvz

Description

@mjbvz

From @fleck on April 6, 2018 15:7

  • VSCode Version: 1.22.0
  • OS Version: MacOS 10.13.3

Steps to Reproduce:
Create the following file:

/**
 * Create a notification.
 * @param {string} options.heading Text for the header.
 * @param {string} [options.href] Where the primary button links to. The image will also be linked
 * to this href if an image is included.
 * @param {string} [options.imageUrl] Optional image url.
 * @param {string} [options.body] Optional text for the body.
 * @param {string} [options.buttonText] Text of the primary button.
 * @param {string} [options.secondButtonText] Text of the secondary button.
 * @param {string} [options.secondHref] Href of secondary button.
 * @param {string} [type] Add error styling by passing 'Error' for this parameter.
 * @param {object} options Object properties are interpolated into the error template.
 */
const Notification = (options, type = 'default') => {
};

export default Notification;

import the previous file and hover over Notification();

import Notification from './Notification';

Notification();

The signature of the function param 'object' is wrongly classified as any, but the descriptions below are correct.
signature incorrect

Move options object description to the first position

/**
 * Create a notification.
 * @param {object} options Object properties are interpolated into the error template.
 * @param {string} options.heading Text for the header.
 * @param {string} [options.href] Where the primary button links to. The image will also be linked
 * to this href if an image is included.
 * @param {string} [options.imageUrl] Optional image url.
 * @param {string} [options.body] Optional text for the body.
 * @param {string} [options.buttonText] Text of the primary button.
 * @param {string} [options.secondButtonText] Text of the secondary button.
 * @param {string} [options.secondHref] Href of secondary button.
 * @param {string} [type] Add error styling by passing 'Error' for this parameter.
 */
const Notification = (options, type = 'default') => {
};

export default Notification;

and now hover over Notification(); and you'll see that the signature is correct, but the descriptions are now wrong.

bad description

Does this issue occur when all extensions are disabled?: Yes

Copied from original issue: microsoft/vscode#47333

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions