Skip to content

fix(no-unnecessary-type-arguments): handle Partial aliases in default-type checks#862

Merged
graphite-app[bot] merged 1 commit into
mainfrom
c/04-01-fix_no-unnecessary-type-arguments_handle_partial_aliases_in_default-type_checks
Apr 2, 2026
Merged

fix(no-unnecessary-type-arguments): handle Partial aliases in default-type checks#862
graphite-app[bot] merged 1 commit into
mainfrom
c/04-01-fix_no-unnecessary-type-arguments_handle_partial_aliases_in_default-type_checks

Conversation

@camc314

@camc314 camc314 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

fixes #861

camc314 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camc314 camc314 marked this pull request as ready for review April 1, 2026 08:21
Copilot AI review requested due to automatic review settings April 1, 2026 08:21
@camc314 camc314 self-assigned this Apr 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a false positive in no-unnecessary-type-arguments where type arguments involving Partial<...> aliases could be incorrectly treated as matching a type parameter’s default, and therefore flagged as unnecessary.

Changes:

  • Use checker.Checker_getTypeFromTypeNode for type-argument/default-type comparisons in the rule’s “default type” check path.
  • Add regression test cases covering the Partial alias scenario from issue #861.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/rules/no_unnecessary_type_arguments/no_unnecessary_type_arguments.go Adjusts type resolution used for default-type equivalence checks to avoid Partial-alias false positives.
internal/rules/no_unnecessary_type_arguments/no_unnecessary_type_arguments_test.go Adds regression tests reproducing issue #861 to ensure no warning is emitted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/rules/no_unnecessary_type_arguments/no_unnecessary_type_arguments.go Outdated
@camc314 camc314 force-pushed the c/04-01-fix_no-unnecessary-type-arguments_handle_partial_aliases_in_default-type_checks branch from edb4690 to 2ee8725 Compare April 2, 2026 13:02
@camc314 camc314 added the 0-merge label Apr 2, 2026

camc314 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

@graphite-app graphite-app Bot force-pushed the c/04-01-fix_no-unnecessary-type-arguments_handle_partial_aliases_in_default-type_checks branch from da5aa25 to 8077d48 Compare April 2, 2026 13:13
@graphite-app graphite-app Bot merged commit 8077d48 into main Apr 2, 2026
8 checks passed
@graphite-app graphite-app Bot removed the 0-merge label Apr 2, 2026
@graphite-app graphite-app Bot deleted the c/04-01-fix_no-unnecessary-type-arguments_handle_partial_aliases_in_default-type_checks branch April 2, 2026 13:20
camc314 added a commit that referenced this pull request Apr 16, 2026
Align with typescript-eslint#12199 by reverting the #853 port of inferred-type reporting.

Keep the later default-type equivalence fix from #862.

Verification:
- go test ./internal/rules/no_unnecessary_type_arguments/...
- cd e2e && pnpm test --run snapshot.test.ts
camc314 added a commit that referenced this pull request Apr 16, 2026
Align with typescript-eslint#12199 by reverting the #853 port of inferred-type reporting.

Keep the later default-type equivalence fix from #862.

Verification:
- go test ./internal/rules/no_unnecessary_type_arguments/...
- cd e2e && pnpm test --run snapshot.test.ts
graphite-app Bot pushed a commit that referenced this pull request Apr 16, 2026
Align with typescript-eslint/typescript-eslint#12199 by reverting the #853 port of inferred-type reporting.

Keep the later default-type equivalence fix from #862.

Validation:
- go test ./internal/rules/no_unnecessary_type_arguments/...
- cd e2e && pnpm test --run snapshot.test.ts

fixes oxc-project/oxc#21464
fixes #875
fixes oxc-project/oxc#21096
fises oxc-project/oxc#20933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

false positives in typescript-eslint(no-unnecessary-type-arguments) with Partial

2 participants