<!--
title: Names reveal semantic purpose
domain: runtimes
topic: Naming Conventions
language: TypeScript
source: microsoft/typescript
updated: 2025-05-31
url: https://awesomereviewers.com/reviewers/typescript-names-reveal-semantic-purpose/
-->

Choose names that clearly communicate the semantic purpose and behavior of code elements. Variable and function names should precisely reflect their role, return type, and intended usage.

Key guidelines:
1. Function names should indicate their behavior and return type
2. Use distinct names for related but different concepts
3. Choose specific over generic names
4. Fix misleading names immediately

Example:
```typescript
// Poor naming
function isGlobalType(checker: TypeChecker, symbol: Symbol) {
    return checker.resolveName(symbol.name, undefined, SymbolFlags.Type, false);
}

// Better naming - reflects actual behavior
function canResolveTypeGlobally(checker: TypeChecker, typeName: string) {
    return checker.resolveName(typeName, undefined, SymbolFlags.Type, false);
}

// Poor naming - reusing variable
let initializer = getCandidateVariableDeclarationInitializer(declaration);
if (initializer) { ... }
initializer = getDestructuredInitializer(declaration);

// Better naming - distinct purposes
let directInit = getCandidateVariableDeclarationInitializer(declaration);
if (directInit) { ... }
let destructuredInit = getDestructuredInitializer(declaration);
```
