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

Enhancement: [no-unnecessary-type-arguments] Check unnecessary type arguments in Tagged templates #8706

Closed
4 tasks done
yeonjuan opened this issue Mar 18, 2024 · 0 comments · Fixed by #8708
Closed
4 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@yeonjuan
Copy link
Contributor

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/no-unnecessary-type-arguments

Description

Currently, no-unnecessary-type-arguments does not report any errors when Tagged templates have unnecessary type arguments.

see playground

function foo<T = number>(
  templates: TemplateStringsArray,
  a: T,
  b: T
) {
  // ...
}

foo<number>`${1}, ${2}`; 

I suggest that no-unnecessary-type-arguments also handles Tagged Templates.

Fail

function f<T = number>(templates: TemplateStringsArray, arg: T) {}
f<number>\`\${1}\`;

Pass

function f<T = number>(templates: TemplateStringsArray, arg: T) {}
f\`\${1}\`;

Additional Info

No response

@yeonjuan yeonjuan added enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 18, 2024
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Mar 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants