Skip to content

valid type being marked invalid #712

@jsg2021

Description

@jsg2021

I've written a typedef comment at the top of my file:

/** @typedef {{ scope: any; [key: string]: string | Handler }} HandlerMapping */

(mode = typescript)
The error is with the [key: string]: x bit.

Expected behavior

To pass valid-types check.

Actual behavior

{
	"resource": "...",
	"owner": "eslint",
	"code": {
		"value": "jsdoc/valid-types",
		"target": {
			"$mid": 1,
			"external": "https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types",
			"path": "/gajus/eslint-plugin-jsdoc",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "eslint-plugin-jsdoc-rules-valid-types"
		}
	},
	"severity": 4,
	"message": "Syntax error in type: { scope: any; [key: string]: string | Handler }",
	"source": "eslint",
	"startLineNumber": 13,
	"startColumn": 1,
	"endLineNumber": 13,
	"endColumn": 1
}

ESLint Config

---
extends:
  - plugin:jsdoc/recommended
plugins:
  - jsdoc
settings:
  jsdoc:
    mode: typescript

ESLint sample

/** @typedef {(...x: any[]) => void} Handler */
/** @typedef {{ scope: any; [key: string]: string | Handler }} HandlerMapping */

Environment

  • Node version: v15.12.0
  • ESLint version v7.24.0
  • eslint-plugin-jsdoc version: 32.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions