-
-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Labels
Description
Expected behavior
Some types are generics and the default value for the generic variables, if they exist, may not be correct for the usage. An example would be setting the ExecutionContext in AVA's test function:
/**
* @typedef Context
* @property {number} foo
*/
const test = /** @type {import('ava').TestFn<Context>} */ (require('ava').default);
test.before((t) => {
t.context.foo = 42;
});Typescript marks the above code as valid, and code suggestions work as expected.
Actual behavior
ESLint as configured below, shows a warning for the line t.context.foo = 42;.
The warning is: '@type' is redundant when using a type system jsdoc/check-tag-names
If you remove the @type declaration, then:
- ESLint is satisfied
- Typescript throws an error:
TS18046: t.context is of type unknown.
ESLint Config
{
"extends": [
"plugin:jsdoc/recommended-typescript"
]
}ESLint sample
See the example in Expected behavior above
Environment
- Node version: v20.3.0
- ESLint version: v8.46.0
eslint-plugin-jsdocversion: 46.4.6