Closed Lalem001 closed 1 year ago
I think the idea is to use as
type-assertions instead of a @type
tag: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions
I think the idea is to use
as
type-assertions instead of a@type
tag: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions
I am not writing in Typescript though. I am writing in JavaScript with JSDoc, and type checking with TS. This way there is no compile step for running in node.
Am I using the wrong configuration?
You should be using plugin:jsdoc/recommended-typescript-flavor
instead.
Indeed. Thanks for the help.
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:
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:TS18046: t.context is of type unknown
.ESLint Config
ESLint sample
See the example in
Expected behavior
aboveEnvironment
eslint-plugin-jsdoc
version: 46.4.6