Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-undefined-types error when casting a generic template #827

Closed
jespertheend opened this issue Dec 22, 2021 · 2 comments
Closed

no-undefined-types error when casting a generic template #827

jespertheend opened this issue Dec 22, 2021 · 2 comments

Comments

@jespertheend
Copy link

Expected behavior

No error when casting generic types.

Actual behavior

The type 'T' is undefined. (jsdoc/no-undefined-types)

ESLint Config

module.exports = {
	root: true,
	parser: "@babel/eslint-parser",
	parserOptions: {
		requireConfigFile: false,
	},
	env: {
		browser: true,
		es2021: true,
	},
	extends: "eslint:recommended",
	plugins: [
		"jsdoc",
	],
	settings: {
		jsdoc: {
			mode: "typescript",
		},
	},
	rules: {
		"jsdoc/no-undefined-types": ["error"],
	},
};

ESLint sample

/**
 * @template T
 */
export class Foo {
	// cast to T
	getType() {
		const x = "hello";
		const y = /** @type {T} */ (x);
		return y;
	}
}

Environment

  • Node version: v16.13.0
  • ESLint version: v8.2.0
  • eslint-plugin-jsdoc version: 37.4.0
@jespertheend
Copy link
Author

Hmm I think this might be a duplicate of #559, not sure

@gajus
Copy link
Owner

gajus commented Jan 3, 2022

🎉 This issue has been resolved in version 37.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants