Ensure that similar APIs follow consistent patterns and conventions across the codebase. When designing or modifying APIs, maintain the same expressivity, return type patterns, and usage conventions as existing similar APIs.
Key areas to check:
OneOrMany<T>
consistently across similar APIs rather than mixing single values and arrays arbitrarilyExample from the codebase:
// Inconsistent - mixing different return patterns
function someApi(): ValidationError | ValidationError[] // inconsistent with other APIs
// Consistent - following established OneOrMany pattern
function someApi(): OneOrMany<ValidationError> // matches other similar APIs
// Inconsistent - different creation patterns
new ReactiveMetadataKey() vs MetadataKey.someFactory()
// Consistent - uniform factory pattern
MetadataKey.reduce() // always use static factories
This helps users build intuitive mental models and reduces cognitive load when working with related APIs.
Enter the URL of a public GitHub repository