typeConstituentDuplicates
Reports duplicate types in unions and intersections.
✅ This rule is included in the ts logical presets.
Duplicate types in unions and intersections are redundant and can make code harder to read.
Examples
Section titled “Examples”Duplicate Union Types
Section titled “Duplicate Union Types”type Value = string | number | string;type Value = string | number;Duplicate Intersection Types
Section titled “Duplicate Intersection Types”type Combined = BaseType & ExtendedType & BaseType;type Combined = BaseType & ExtendedType;Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you have generated types or complex type manipulations where duplicates are intentional, 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.