Choose parameter names that clearly communicate their purpose and avoid confusion with similar concepts. Avoid generic or ambiguous names that could be misinterpreted.
Choose parameter names that clearly communicate their purpose and avoid confusion with similar concepts. Avoid generic or ambiguous names that could be misinterpreted.
When naming parameters, consider:
Example of unclear naming:
export function useInput(
inputHandler: (input: string, meta: Meta) => void
Better alternatives:
export function useInput(
inputHandler: (input: string, metadata: InputMetadata) => void
// or
inputHandler: (input: string, key: KeyInfo) => void
The name meta
is ambiguous because it could be confused with “meta keys” (a different keyboard concept), while metadata
or key
clearly indicate what the parameter contains.
Enter the URL of a public GitHub repository