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

[check-param-names] "Cannot read property 'name' of undefined" with type {(): void} #624

Closed
wnayes opened this issue Aug 17, 2020 · 1 comment

Comments

@wnayes
Copy link

wnayes commented Aug 17, 2020

Seeing an error similar to #529 and #576, but on 30.2.3 when linting TypeScript code like the following:

/**
 * Show a prompt.
 * @param hideButton true if button should be hidden, false otherwise
 * @param onHidden delegate to call when the prompt is hidden
 */
public async showPrompt(hideButton: boolean, onHidden: {(): void}): Promise<void>
{
}

I'd guess the issue has to do with {(): void} as the param type. (I'm aware this could be better typed as () => void or something similar 😄)

I wouldn't suspect a recent a regression of those other issues; I just haven't upgraded until recently. I'm not sure how far back the issue goes.

Expected behavior

No errors.

Actual behavior

Oops! Something went wrong! :(

ESLint: 7.7.0

TypeError: Cannot read property 'name' of undefined
Occurred while linting C:\file.ts:540
    at getPropertiesFromPropertySignature (node_modules\eslint-plugin-jsdoc\dist\jsdocUtils.js:103:28)
    at node_modules\eslint-plugin-jsdoc\dist\jsdocUtils.js:116:18
    at Array.map (<anonymous>)
    at getParamName (node_modules\eslint-plugin-jsdoc\dist\jsdocUtils.js:115:69)
    at node_modules\eslint-plugin-jsdoc\dist\jsdocUtils.js:200:12
    at Array.map (<anonymous>)
    at Object.getFunctionParameterNames (node_modules\eslint-plugin-jsdoc\dist\jsdocUtils.js:199:61)
    at Object.utils.getFunctionParameterNames (node_modules\eslint-plugin-jsdoc\dist\iterateJsdoc.js:187:32)
    at _default.meta.docs.description (node_modules\eslint-plugin-jsdoc\dist\rules\checkParamNames.js:210:40)
    at iterate (node_modules\eslint-plugin-jsdoc\dist\iterateJsdoc.js:539:3)

ESLint Config

"jsdoc/check-param-names": 1,

Environment

  • Node version: 12.16.1.0
  • ESLint version 7.7.0
  • eslint-plugin-jsdoc version: 30.2.3
@gajus
Copy link
Owner

gajus commented Aug 17, 2020

🎉 This issue has been resolved in version 30.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants