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

no-undefined-types: false positive for @template on exported function #578

Closed
kevinoid opened this issue Jun 14, 2020 · 2 comments
Closed

Comments

@kevinoid
Copy link

Expected behavior

The code below would not produce any warnings.

Actual behavior

/tmp/example.js
  4:0  warning  The type 'ValueType' is undefined  jsdoc/no-undefined-types
  5:0  warning  The type 'ValueType' is undefined  jsdoc/no-undefined-types

✖ 2 problems (0 errors, 2 warnings)

Note that if exports.resolve1 = is removed, the warnings do not occur.

ESLint Config

{
  "env": {
    "es6": true
  },
  "extends": [
    "plugin:jsdoc/recommended"
  ],
  "settings": {
    "jsdoc": {
      "mode": "typescript"
    }
  }
}

ESLint sample

/** Gets a Promise resolved with a given value.
 *
 * @template ValueType
 * @param {ValueType} value Value to resolve.
 * @returns {Promise<ValueType>} Promise resolved with value.
 */
exports.resolve1 = function resolve1(value) {
  return Promise.resolve(value);
};

Environment

  • Node version: v14.0.0
  • ESLint version v7.2.0
  • eslint-plugin-jsdoc version: 27.0.7

Related Issues

The issue may be related to #559, but since it occurs on the function where @template is used rather than inside, I thought it may be a separate issue.

@gajus
Copy link
Owner

gajus commented Jun 17, 2020

🎉 This issue has been resolved in version 27.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Jun 17, 2020
@kevinoid
Copy link
Author

I can confirm 27.1.1 fixes the issue for me. Thanks for the fast fix @brettz9 and @gajus!

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

3 participants