{"record":{"id":"f25055a18bc2bb58","repo":"oxc-project/oxc","slug":"this-overload-can-be-combined-with-another-overloa-f25055","errorCode":null,"errorMessage":"This overload can be combined with another overload into one signature with a rest parameter.","messagePattern":"This overload can be combined with another overload into one signature with a rest parameter\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/typescript/unified_signatures.rs","lineNumber":30,"sourceCode":"};\nuse oxc_diagnostics::{LabeledSpan, OxcDiagnostic};\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse rustc_hash::{FxHashMap, FxHashSet};\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn unified_signatures_diagnostic<L: Into<LabeledSpan>, T: IntoIterator<Item = L>>(\n    message: String,\n    labels: T,\n) -> OxcDiagnostic {\n    OxcDiagnostic::warn(message).with_labels(labels)\n}\n\n#[derive(Debug, Default, Clone, Deserialize, Serialize, JsonSchema)]\n#[serde(default, rename_all = \"camelCase\", deny_unknown_fields)]\npub struct UnifiedSignaturesOptions {\n    /// Whether to ignore parameter name differences when comparing signatures. If `false`, signatures\n    /// will not be considered unifiable if they have parameters in the same position with different\n    /// names, even if the parameter types are the same.\n    ignore_differently_named_parameters: bool,\n    /// Whether to ignore JSDoc differences when comparing signatures. If `false`, signatures will not\n    /// be considered unifiable if the closest leading block comments for the signatures are different,\n    /// even if the signatures themselves are identical.\n    #[serde(rename = \"ignoreOverloadsWithDifferentJSDoc\")]\n    ignore_overloads_with_different_jsdoc: bool,\n}\n\n#[derive(Debug, Default, Clone, Deserialize, Serialize)]\npub struct UnifiedSignatures(UnifiedSignaturesOptions);","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/unified_signatures.rs#L12-L48","documentation":"Diagnostic from oxlint's `typescript/unified-signatures` rule. When more than two overloads share the same name in the scanned scope, oxlint reports with the singular wording 'This overload can be combined with another overload...', labeling the parameter that only appears in one signature. The rest-parameter variant means the flagged pair differs only in that one signature adds a trailing `...rest` that the other lacks.","triggerScenarios":"Three or more same-named signatures where two of them have identical parameters up to the common prefix, the shorter of the pair does not end in a rest parameter, and the longer adds only a rest parameter. Runs only when the file is parsed as TypeScript (`should_run` checks `source_type().is_typescript()`).","commonSituations":"Broad public API surfaces (event emitters, HTTP clients) with many overloads; refactoring sessions where an overload family grows past two entries; CI lint runs after merging several branches that each added an overload.","solutions":["Merge the flagged pair: drop the shorter overload and keep the one with the rest parameter.","If other overloads in the group make the split intentional, enable `ignoreOverloadsWithDifferentJSDoc` so only JSDoc-distinct splits survive.","Enable `ignoreDifferentlyNamedParameters` if the pair differs only by parameter names on purpose.","Disable the rule for the declaration file with an inline comment or a per-file override in .oxlintrc.json."],"exampleFix":"// before\ndeclare function f(a: number): void;\ndeclare function f(a: number, ...rest: string[]): void;\ndeclare function f(a: boolean): void;\n// after\ndeclare function f(a: number, ...rest: string[]): void;\ndeclare function f(a: boolean): void;","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding a trailing rest variant of an existing signature, replace the original instead of adding a sibling.","Keep overload families small; audit them whenever a third overload with the same name appears.","Run oxlint locally with the typescript preset before pushing so merges are caught pre-review."],"tags":["oxlint","lint","typescript","overloads","rest-parameter","style"],"backgroundTag":"typescript-overload-unification","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}