menu
prefer-nested-or-pattern
Prefer nesting or-patterns inside their shared nominal pattern
Repeating the same nominal pattern in every or-pattern branch obscures the field that varies. Instead, you SHOULD place the alternatives in the shared field pattern.
Reported
1function isSmall(result: Result<int32, string>): boolean {2 return match (result) {3 Ok { value: 0 } | Ok { value: 1 } => true4 _ => false5 };6}Accepted
1function isSmall(result: Result<int32, string>): boolean {2 return match (result) {3 Ok { value: 0 | 1 } => true4 _ => false5 };6}