Type-like
- Selector:
typeLike - Required:
PascalCase - Custom: forbids prefix
I*/T*
Why This Rule
Type aliases, type parameters, and other type-like constructs follow the same reasoning as interfaces:
- PascalCase: Consistency with all other types (classes, interfaces, enums)
- No
T*prefix: Same rationale as avoidingI*- it's redundant in modern TypeScript
The T* prefix was common in older codebases (TUserId, TCallback) but adds no value:
- Type context is clear: If you're using it as a type, it's obviously a type
- Creates naming conflicts:
TUservsUser- which is the "real" name? - Inconsistent across codebases: Some use
T, others useI, others use nothing - standardizing on no prefix is clearest
References:
- This TS naming convention is weird - Matt Pocock - section about unions, I and T prefixes
- TypeScript Handbook - Type Aliases
- Avoid the
Iprefix for interfaces - Mário S. Camargo - detailed explanation applicable to type-like constructs
✅ Good
ts
type UserId = string; // WHY: PascalCase type alias without prefix reads naturally❌ Bad
ts
type IUserId = string; // WHY: `I` prefix is redundant and noisy
type TUser = { id: string }; // WHY: `T` prefix is unnecessary and inconsistent