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

Optionality not honored using @property tags #15916

Closed
mhegazy opened this issue May 17, 2017 · 1 comment
Closed

Optionality not honored using @property tags #15916

mhegazy opened this issue May 17, 2017 · 1 comment
Labels
Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented May 17, 2017

Courtesy of @MikeyBurkman, reported in #11597 (comment)

/**
 * @typedef {Object} Opts
 * @property {string} x
 * @property {string=} y
 * 
 * @param {Opts} opts
 */
function foo(opts) {
  console.log(opts);
}

foo({x: 'abc'});

That call to foo() will be flagged because it's missing y in the opts. The type checker does not recognize any of the methods of specifying optional parameters listed on the wiki. I even tried doing TS-style using @property {string?} y and still no luck.

@mhegazy mhegazy added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Salsa labels May 17, 2017
@mhegazy mhegazy added this to the TypeScript 2.4 milestone May 17, 2017
@mhegazy mhegazy assigned yuit and unassigned rbuckton May 23, 2017
@yuit
Copy link
Contributor

yuit commented May 24, 2017

Note: we should make sure that quick-info reflect the optionality as well

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label May 26, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants