Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destructuring parameter JSDoc not matched up correctly #24045

Open
mhegazy opened this issue May 10, 2018 · 1 comment
Open

Destructuring parameter JSDoc not matched up correctly #24045

mhegazy opened this issue May 10, 2018 · 1 comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Milestone

Comments

@mhegazy
Copy link
Contributor

mhegazy commented May 10, 2018

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:

@mhegazy mhegazy added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Salsa labels May 10, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone May 10, 2018
@DanielRosenwasser
Copy link
Member

Make sure the basic case works too.

/**
 * @param options {{ response: any, session: any }}
 */
function handle({ response, session }) {
}

@mhegazy mhegazy modified the milestones: TypeScript 3.0, Future Jul 2, 2018
@weswigham weswigham added Domain: JavaScript The issue relates to JavaScript specifically and removed Salsa labels Nov 29, 2018
azu added a commit to asciidwango/js-primer that referenced this issue Dec 30, 2018
この書籍の主題ではないので、できるだけコンパクトな方法を採用

- microsoft/TypeScript#24045
- google/closure-compiler#1781
- microsoft/TypeScript#24746

fix #606
azu added a commit to asciidwango/js-primer that referenced this issue Dec 30, 2018
* fix(todo): JSDocのdestructuringの記法を修正

この書籍の主題ではないので、できるだけコンパクトな方法を採用

- microsoft/TypeScript#24045
- google/closure-compiler#1781
- microsoft/TypeScript#24746

fix #606

* fix(todo): removeEventListerを削除

TODOアプリのユースケースでは解除まで行っていないので削除する

fix #607

* feat(todo): 残った課題を追加

* chore(todo): add comment

* fix(todo): add <!-- doctest:disable -->
@sandersn sandersn removed their assignment Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Projects
None yet
Development

No branches or pull requests

4 participants