Naming Conventions That Clarify
You'll learn: How specific naming patterns like Props, Config, and Result make your TypeScript code self-documenting and intention crystal clear.
The Power of Naming Conventions
When you see a type called UserProps, you instantly know it's the shape of data passed to a component. When you see ApiResponse, you know it's data coming back from a network call. These aren't arbitrary names—they're conventions that communicate intent without reading a single line of implementation code.
Think of type names like road signs. A generic sign saying "Place" doesn't help you navigate. But "Exit," "Rest Stop," or "Emergency Phone" tells you exactly what you're approaching. Type naming works the same way.
Common Clarifying Suffixes
Props: Component input shapes (especially React)
interface ButtonProps {
text: string;
onClick: () => void;
disabled?: boolean;
}
Config: Configuration objects for initializing systems
interface DatabaseConfig {
host: string;
port: number;
retryAttempts: number;
}
Result: Return values, especially from operations that might fail
type FetchResult<T> =
| { success: true; data: T }
| { success: false; error: string };
Options: Optional configuration parameters
interface SearchOptions {
caseSensitive?: boolean;
maxResults?: number;
}
Params: URL or route parameters
interface UserParams {
userId: string;
includeProfile: boolean;
}
The Consistency Advantage
When your team adopts these conventions, scanning code becomes effortless. You see LoginFormProps and immediately understand its role without checking where it's used. You see PaymentConfig and know it's initialization data, not runtime state.
This consistency reduces cognitive load and makes refactoring safer—you can trust the name to reveal the type's purpose.
Key Takeaway: Naming conventions like Props, Config, Result, Options, and Params turn your types into self-documenting code that communicates intent at a glance.