-
-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
Description
Expected behavior
typescript supports defining a default value for a template type in JSDoc (with a syntax inspired from the @param
default values) since 2021 (implemented in microsoft/TypeScript#45483) but the jsdoc/valid-types
rule breaks on them.
Actual behavior
jsdoc/valid-types
reports an error Syntax error in namepath: HTMLElement>]
ESLint Config
import jsdoc from 'eslint-plugin-jsdoc'
export default [{
plugins: {
jsdoc
},
settings: {
jsdoc: {
mode: 'typescript',
},
},
rules: {
'jsdoc/valid-types': 'error',
}
}]
ESLint sample
/**
* @template {string} Selector
* @template {keyof GlobalEventHandlersEventMap} TEventType
* @template {Element} [TElement=import('typed-query-selector/parser').ParseSelector<Selector, HTMLElement>]
* @param {Selector} selector
* @param {TEventType} type
* @param {import('delegate-it').DelegateEventHandler<GlobalEventHandlersEventMap[TEventType], TElement>} callback
* @param {Omit<AddEventListenerOptions, 'once' | 'signal'>} [options]
* @returns {void}
*/
export function onGlobalEvent (selector, type, callback, options) {
delegate(document, selector, type, callback, options)
}
Environment
- Node version: 22.18.0
- ESLint version: 9.33.0
eslint-plugin-jsdoc
version: 54.1.1