Skip to content

fix(eslint-plugin): [no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body#12394

Merged
JoshuaKGoldberg merged 3 commits into
typescript-eslint:mainfrom
Deftera186:fix/no-unnecessary-type-assertion-arrow-object
Jun 15, 2026
Merged

fix(eslint-plugin): [no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body#12394
JoshuaKGoldberg merged 3 commits into
typescript-eslint:mainfrom
Deftera186:fix/no-unnecessary-type-assertion-arrow-object

Conversation

@Deftera186

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

The single-assertion autofixer for no-unnecessary-type-assertion removed an angle-bracket assertion (<T>expr) by deleting just the <...> tokens. That works fine in most positions, but when the asserted value is an object literal that is the concise body of an arrow function, dropping the brackets turns () => <T>{ ... } into () => { ... }, which the parser reads as a block statement rather than an object literal — so the autofix output is a syntax error (the case from #12393).

The fix detects exactly that shape (object literal expression whose parent is an arrow function and is its body) and replaces the whole assertion with the object literal wrapped in parentheses, producing () => ({ ... }). This reuses the same condition the rule already applies to the double-assertion path a few lines below, so the two fixers now behave consistently.

I only added an invalid test case here: the assertion is still (correctly) flagged as unnecessary, so there is no new valid behavior to cover — the change is purely to the fix output. I confirmed the new test fails on main (the rule tester reports a fatal parsing error in the autofix) and passes with the change.

Disclosure: I used an AI assistant to help locate the relevant code and draft the fix. I reviewed and understand the change, and verified it locally (full rule test suite + lint).

💖

…eAssertion in arrow body

The no-unnecessary-type-assertion autofixer removed the angle-bracket
type assertion by deleting only the `<...>` tokens. When the asserted
expression is an object literal that forms the body of an arrow function
(e.g. `() => <T>{ ... }`), this produced `() => { ... }`, which parses as
a block statement and is a syntax error.

Wrap the object literal in parentheses in that case, mirroring the
existing handling for double assertions.

Fixes typescript-eslint#12393.

Assisted-by: Claude (Anthropic AI)
Signed-off-by: Deftera <55022020+Deftera186@users.noreply.github.com>
@typescript-eslint

Copy link
Copy Markdown
Contributor

Thanks for the PR, @Deftera186!

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 Jun 1, 2026

Copy link
Copy Markdown

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 0234906
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6a275aa788659f0008848202
😎 Deploy Preview https://deploy-preview-12394--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: 99 (no change 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 Jun 1, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 0234906

Command Status Duration Result
nx run-many -t lint --projects=typescript-estre... ✅ Succeeded 54s View ↗
nx run generate-configs ✅ Succeeded 7s View ↗
nx run-many -t lint --projects=eslint-plugin --... ✅ Succeeded 52s View ↗
nx run-many -t typecheck:tsgo ✅ Succeeded 47s View ↗
nx run-many -t typecheck ✅ Succeeded 35s View ↗
nx run-many -t lint --projects=parser,type-util... ✅ Succeeded 29s View ↗
nx run-many -t lint --projects=ast-spec,utils,s... ✅ Succeeded 29s View ↗
nx run types:build ✅ Succeeded 1s View ↗
Additional runs (12) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-09 00:16:34 UTC

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.69%. Comparing base (5973d5b) to head (0234906).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12394      +/-   ##
==========================================
+ Coverage   86.99%   94.69%   +7.69%     
==========================================
  Files         513      222     -291     
  Lines       16546    11377    -5169     
  Branches     5165     3788    -1377     
==========================================
- Hits        14394    10773    -3621     
+ Misses       1461      257    -1204     
+ Partials      691      347     -344     
Flag Coverage Δ
unittest 94.69% <100.00%> (+7.69%) ⬆️

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.32% <100.00%> (+0.09%) ⬆️

... and 292 files with indirect coverage changes

🚀 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.

@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.

This basically fixes the bug, but let's tighten up some details around preserving comments in the fix. Thanks!

Comment thread packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts Outdated
Comment thread packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts Outdated
NullThrowsReasons.MissingToken('>', 'type annotation'),
);
if (
node.expression.type === AST_NODE_TYPES.ObjectExpression &&

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.

This condition might not be sufficient, actually... A case like this, though unclear why it would exist in real world code, would also suffer from the same problem:

<{ a: string }>{ a: 'foo' };

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.

Right, the bare statement form has the same hazard. Extended the condition to also fire when node.parent.type === ExpressionStatement and added <{ a: string }>{ a: 'foo' }; as a test.

There's a slightly broader class I didn't tackle here: when the assertion sits at the left edge of a larger expression statement, e.g. <T>{ a: 1 }.x; or <T>{ a: 1 } + 1;, the resulting { still leads the statement. Catching that properly would mean walking up through left-edge parents (member, binary, logical, conditional test, sequence head, call/new callee, tagged template tag). Happy to expand into that walk in this PR if you'd prefer it covered here, or leave it for a follow-up since it's a narrower class than the originally reported bug.

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.

Oh, interesting! Let's not worry about handling that complexity, but I appreciate you looking into it!

Thanks!

NullThrowsReasons.MissingToken('>', 'type annotation'),
);
if (
node.expression.type === AST_NODE_TYPES.ObjectExpression &&

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.

(optional) could consider exporting and reusing the helper function isObjectExpressionInOneLineReturn() from the getWrappingFixer() logic?

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.

Held off on it for now because the inline check also needs to fire on the ExpressionStatement case from your other comment, and isObjectExpressionInOneLineReturn only covers the arrow-body branch. Would you prefer I widen that helper (rename it to something like needsParensWhenUnwrapped and add the statement-level branch) and import it from getWrappingFixer, or keep the predicate inline here?

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.

I think the two options that make sense to me are:

  1. Keep it exactly as is
  2. (maybe slightly preferred?) Just import isObjectExpressionInOneLineReturn and don't bother dealing with the ExpressionStatement edge case at all in no-unnecessary-type-assertion (especially in light of https://github.com/typescript-eslint/typescript-eslint/pull/12394/changes#r3347832383, in which you noted that checking whether the parent is an ExpressionStatement isn't even actually sufficient for that class of problem)

Choice is yours!

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 honestly think partial coverage is still better than zero coverage here, so I'll keep it as-is. I filed #12418 to track the broader left-edge case so someone can tackle it whenever.

…el case

Address review feedback on typescript-eslint#12394:

- Replace the dedicated arrow-body branch (which used `replaceText` over
  the whole node) with a unified `needsParens` flag that adds parens
  via `insertTextBefore`/`insertTextAfter` around the existing
  angle-bracket removal. This preserves comments that sit between the
  closing `>` and the object literal.
- Extend the wrapping condition to also cover ObjectExpression at the
  start of an ExpressionStatement (e.g. `<T>{ a: 'foo' };`), which
  otherwise rewrites to `{ a: 'foo' };` and parses as a block.
- Skip wrapping when the assertion or its inner expression is already
  parenthesized, so `(<T>{...})` and `<T>({...})` don't gain a second
  set of parens.

Adds tests for comment preservation, the already-parenthesized cases,
and the statement-level case.

Assisted-by: Claude (Anthropic AI)
Signed-off-by: Deftera <55022020+Deftera186@users.noreply.github.com>
@kirkwaiblinger kirkwaiblinger changed the title fix(eslint-plugin): wrap object literal in parens when removing TSTypeAssertion in arrow body fix(eslint-plugin): [no-unnecessary-type-assertion] wrap object literal in parens when removing TSTypeAssertion in arrow body Jun 9, 2026
NullThrowsReasons.MissingToken('>', 'type annotation'),
);
if (
node.expression.type === AST_NODE_TYPES.ObjectExpression &&

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.

Oh, interesting! Let's not worry about handling that complexity, but I appreciate you looking into it!

Thanks!

NullThrowsReasons.MissingToken('>', 'type annotation'),
);
if (
node.expression.type === AST_NODE_TYPES.ObjectExpression &&

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.

I think the two options that make sense to me are:

  1. Keep it exactly as is
  2. (maybe slightly preferred?) Just import isObjectExpressionInOneLineReturn and don't bother dealing with the ExpressionStatement edge case at all in no-unnecessary-type-assertion (especially in light of https://github.com/typescript-eslint/typescript-eslint/pull/12394/changes#r3347832383, in which you noted that checking whether the parent is an ExpressionStatement isn't even actually sufficient for that class of problem)

Choice is yours!

@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.

Looks good to me to merge as is! If you want to make any changes along the lines of https://github.com/typescript-eslint/typescript-eslint/pull/12394/changes#r3377104255 feel free to do so but completely up to you.

Thanks!

@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 Jun 9, 2026
@JoshuaKGoldberg JoshuaKGoldberg merged commit 1b5d543 into typescript-eslint:main Jun 15, 2026
43 of 44 checks passed
@JoshuaKGoldberg

Copy link
Copy Markdown
Member

(merging now to get this in with the release today)

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 autofix introduces syntax error for ObjectExpression in TSTypeAssertion in ArrowFunctionExpression

3 participants