Skip to content

fix(eslint-plugin): [no-unnecessary-type-assertion] avoid false positive for template literal expressions#12281

Merged
JoshuaKGoldberg merged 6 commits into
typescript-eslint:mainfrom
anasm266:anasc/no-unnecessary-type-assertion-template-literals
Jun 13, 2026
Merged

fix(eslint-plugin): [no-unnecessary-type-assertion] avoid false positive for template literal expressions#12281
JoshuaKGoldberg merged 6 commits into
typescript-eslint:mainfrom
anasm266:anasc/no-unnecessary-type-assertion-template-literals

Conversation

@anasm266

@anasm266 anasm266 commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

Skips the contextual unnecessary-assertion check for template literal expressions with interpolations, where the assertion is still needed for the mapped ValuePath case from #12276 to typecheck.

Adds a regression test for the issue repro.

💖

@typescript-eslint

Copy link
Copy Markdown
Contributor

Thanks for the PR, @anasm266!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify

netlify Bot commented Apr 26, 2026

Copy link
Copy Markdown

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 45c6632
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6a17c303a8faaf000866b68b
😎 Deploy Preview https://deploy-preview-12281--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (🔴 down 2 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 90 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Apr 26, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 382f88e

Command Status Duration Result
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 3s View ↗
nx run-many -t lint --projects=parser,type-util... ✅ Succeeded 21s View ↗
nx run types:build ✅ Succeeded 1s View ↗
nx run generate-configs ✅ Succeeded 4s View ↗
nx run-many -t lint --projects=eslint-plugin --... ✅ Succeeded 50s View ↗
nx run-many -t typecheck:tsgo ✅ Succeeded 6s View ↗
nx run-many -t typecheck ✅ Succeeded 10s View ↗
nx run-many -t lint --projects=ast-spec,utils,s... ✅ Succeeded 29s View ↗
Additional runs (38) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-05-28 04:27:35 UTC

@anasm266 anasm266 marked this pull request as ready for review April 26, 2026 05:37

@kirkwaiblinger kirkwaiblinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the AI contribution policy. The PR description is currently overtly in violation.

I'd normally close this PR on sight, but I see you've already successfully followed the AI policy on other PRs, such as #12278... What happened here? In any case please fix this one up for review.

@anasm266 anasm266 requested a review from kirkwaiblinger April 30, 2026 00:23

const isContextuallyUnnecessary =
!typeAnnotationIsConstAssertion &&
!isTemplateLiteralWithExpressions(node.expression) &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tests fail if I place

        if (isTemplateLiteralWithExpressions(node.expression)) {
          return;
        }

right at the top of the 'TSAsExpression, TSTypeAssertion' selector.

Similarly, the isTemplateLiteralWithExpressions(node.expression) is rendered useless by this change:

    function isImplicitlyNarrowedLiteralDeclaration({
      expression,
      parent,
    }: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion): boolean {
      /**
       * Even on `const` variable declarations, template literals with expressions can sometimes be widened without a type assertion.
       * @see https://github.com/typescript-eslint/typescript-eslint/issues/8737
       */
      if (isTemplateLiteralWithExpressions(expression)) {
        return false;
      }

This indicates one or more of:

  • the new check is not placed in the correct position
  • the tests are lacking and should give a counterexample to why the new check should be placed where it is, not be at the beginning of the selector
  • the existing check is now obsolete and should be cleaned up

Would you please have a look to determine which it is and ensure that the tests support that outcome? thanks!

Also, for context, the added check is a syntactic check (fast), whereas the type analyses are comparatively slow. Therefore, it's beneficial to short-circuit on syntactic analysis before type analyses when possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated in 225116c.

I kept the template-literal check scoped to contextual type fallback rather than returning at the top of the selector. I also added an interpolated-template invalid case that still reports as unnecessaryAssertion, which would fail if the check were moved to the top-level selector.

The existing isImplicitlyNarrowedLiteralDeclaration check remains relevant for the earlier unchanged-type/literal inference path.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the existing template literal check is still not doing anything in any test, though, since the return false; is never executed.

You can see this on the coverage report (or by popping open the debugger or by replacing the return false; with throw new Error() or whatever):

https://app.codecov.io/gh/typescript-eslint/typescript-eslint/pull/12281/blob/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts#L180

@anasm266 anasm266 May 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a valid checkLiteralConstAssertions: true case for the #8737 template-literal branch.

Locally, replacing the return false in isImplicitlyNarrowedLiteralDeclaration with throw new Error('hit') now fails on that new test, so that branch is exercised.

I also rechecked the existing interpolated-template as string invalid case: adding a blanket top-level return for interpolated templates makes that case stop reporting, so the #12276 guard still needs to stay scoped to the contextual fallback path.

@kirkwaiblinger kirkwaiblinger added the awaiting response Issues waiting for a reply from the OP or another party label May 18, 2026
@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.00%. Comparing base (a671d1c) to head (45c6632).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12281      +/-   ##
==========================================
+ Coverage   86.99%   87.00%   +0.01%     
==========================================
  Files         513      513              
  Lines       16546    16548       +2     
  Branches     5165     5166       +1     
==========================================
+ Hits        14394    14398       +4     
+ Misses       1461     1460       -1     
+ Partials      691      690       -1     
Flag Coverage Δ
unittest 87.00% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...-plugin/src/rules/no-unnecessary-type-assertion.ts 95.84% <100.00%> (+0.62%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anasm266 anasm266 requested a review from kirkwaiblinger May 19, 2026 04:01
@github-actions github-actions Bot removed the awaiting response Issues waiting for a reply from the OP or another party label May 19, 2026

@kirkwaiblinger kirkwaiblinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have another look at #12281 (comment) 🙏

@kirkwaiblinger kirkwaiblinger added the awaiting response Issues waiting for a reply from the OP or another party label May 19, 2026
@anasm266 anasm266 requested a review from kirkwaiblinger May 22, 2026 02:15
@github-actions github-actions Bot removed the awaiting response Issues waiting for a reply from the OP or another party label May 22, 2026
@kirkwaiblinger

Copy link
Copy Markdown
Member

Ok, I think I'm happy with this. Thank you for for crafting tests to prove out the change!

@kirkwaiblinger kirkwaiblinger added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label May 28, 2026

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆒

@JoshuaKGoldberg JoshuaKGoldberg merged commit 565e666 into typescript-eslint:main Jun 13, 2026
66 of 68 checks passed
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jun 21, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.61.1 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.61.1 |


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jun 24, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.62.0 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.62.0 |


## [v8.62.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

##### 🚀 Features

- remove redundant package.json "files" ([#12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jun 24, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.62.0 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.62.0 |


## [v8.62.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

##### 🚀 Features

- remove redundant package.json "files" ([#12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jun 27, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.62.0 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.62.0 |


## [v8.62.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

##### 🚀 Features

- remove redundant package.json "files" ([#12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jul 1, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.62.1 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.62.1 |


## [v8.62.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8621-2026-06-29)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-type-assertion] parenthesize object literal at left edge of expression statement ([#12443](typescript-eslint/typescript-eslint#12443), [#12418](typescript-eslint/typescript-eslint#12418))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] preserve boolean result in fixer for nullable true comparisons ([#12365](typescript-eslint/typescript-eslint#12365))
- **eslint-plugin:** \[prefer-optional-chain] use suggestion instead of autofix for trailing binary operator ([#12328](typescript-eslint/typescript-eslint#12328))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- mdm317
- Patrick Aleite
- 송재욱

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.62.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

##### 🚀 Features

- remove redundant package.json "files" ([#12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jul 4, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.61.0 | 8.62.1 |
| npm        | @typescript-eslint/parser        | 8.61.0 | 8.62.1 |


## [v8.62.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8621-2026-06-29)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-type-assertion] parenthesize object literal at left edge of expression statement ([#12443](typescript-eslint/typescript-eslint#12443), [#12418](typescript-eslint/typescript-eslint#12418))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] preserve boolean result in fixer for nullable true comparisons ([#12365](typescript-eslint/typescript-eslint#12365))
- **eslint-plugin:** \[prefer-optional-chain] use suggestion instead of autofix for trailing binary operator ([#12328](typescript-eslint/typescript-eslint#12328))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- mdm317
- Patrick Aleite
- 송재욱

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.62.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

##### 🚀 Features

- remove redundant package.json "files" ([#12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.61.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8611-2026-06-15)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-template-expression] respect ECMAScript line terminators ([#12388](typescript-eslint/typescript-eslint#12388))
- **eslint-plugin:** \[no-unnecessary-boolean-literal-compare] fix precedence bug in autofix ([#12413](typescript-eslint/typescript-eslint#12413))
- **eslint-plugin:** \[no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body ([#12394](typescript-eslint/typescript-eslint#12394), [#12393](typescript-eslint/typescript-eslint#12393))
- **eslint-plugin:** \[no-unnecessary-type-assertion] avoid false positive for template literal expressions ([#12281](typescript-eslint/typescript-eslint#12281))
- **eslint-plugin:** \[consistent-indexed-object-style] do not remove comments when fixing ([#12396](typescript-eslint/typescript-eslint#12396), [#10577](typescript-eslint/typescript-eslint#10577))

##### ❤️ Thank You

- Anas [@anasm266](https://github.com/anasm266)
- Deftera [@Deftera186](https://github.com/Deftera186)
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- lumir
- Sarath Francis [@sarathfrancis90](https://github.com/sarathfrancis90)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [no-unnecessary-type-assertion] Inconsistency and/or false positives with template literals

3 participants