Skip to content

[check-param-names] Constructor parameter type throws error with TypeScript #576

@ehacke

Description

@ehacke

Expected behavior

Passing valid TS Constructor as arg should not throw an error

Actual behavior

Passing valid TS Constructor as arg does throw an error

Oops! Something went wrong! :(

ESLint: 7.2.0

TypeError: Cannot read property 'name' of undefined
Occurred while linting thing.ts:11
    at getPropertiesFromPropertySignature (./node_modules/eslint-plugin-jsdoc/dist/jsdocUtils.js:96:28)

Similar to #570

ESLint Config

module.exports = {
  plugins: ['@typescript-eslint', 'jsdoc'],
  extends: ['plugin:@typescript-eslint/recommended'],
  parser: '@typescript-eslint/parser',
  settings: {
    jsdoc: {
      mode: 'typescript',
    },
  },
  rules: {
    'jsdoc/check-param-names': 'error',
  },
};

ESLint sample

/**
 * @class
 */
export class Thing {
  foo: any;

  /**
   * @param {} params
   * @param {} C
   */
  constructor(C: { new (): any }) {
    this.foo = new C();
  }
}

Environment

  • Node version: 14.3.0
  • ESLint version 7.2.0
  • eslint-plugin-jsdoc version: 27.0.6

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions