fix(no-unnecessary-type-arguments): handle Partial aliases in default-type checks#862
Conversation
How to use the Graphite Merge QueueAdd 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. |
There was a problem hiding this comment.
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_getTypeFromTypeNodefor type-argument/default-type comparisons in the rule’s “default type” check path. - Add regression test cases covering the
Partialalias 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.
edb4690 to
2ee8725
Compare
Merge activity
|
da5aa25 to
8077d48
Compare
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

fixes #861