Skip to content

Destructuring parameter JSDoc not matched up correctly  #24045

@mhegazy

Description

@mhegazy

TypeScript Version: 2.9.0-dev.201xxxxx

Search Terms:

Code

/**
 * @param  {number} options.response
 * @param  {string} options.session
 *
 * @return {void}
 */
function handle({ response, session }) { // fails, { response, session } : { any, any }
}



/**
 * @param  {Object} options
 * @param  {number} options.response
 * @param  {string} options.session
 *
 * @return {void}
 */
function handle({ response, session }) { // Works { response, session } : { number, string }
}

Expected behavior:

  1. params have the right type in side the function
  2. handle should be of type the type ({ response: string, session: number }) => void.

Actual behavior:
In both cases, handle has the type (number) => void.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specifically

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions