unifiedSignatures
Reports function overloads that could be unified.
✅ This rule is included in the ts stylistic presets.
Function overloads that differ only by a single parameter type or by optional parameters can be simplified using union types or optional parameters.
Examples
Section titled “Examples”Union Types
Section titled “Union Types”interface Parser { parse(input: string): Document; parse(input: Buffer): Document;}interface Parser { parse(input: string | Buffer): Document;}Optional Parameters
Section titled “Optional Parameters”interface Logger { log(): void; log(message: string): void;}interface Logger { log(message?: string): void;}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you intentionally use separate overloads for different behaviors or documentation purposes, you may want to disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.