Skip to content

L08 Search and symbol navigation

17 minSuggested first: L07 Repository maps and snapshots

Outcome

Distinguish a definition, use, and re-export, then navigate to the implementation behind a public name.

Learn

A symbol is a named program entity, such as a function or class. Text search proposes candidates, but it can match a comment or an unrelated symbol with the same name. A go-to-definition jump follows an indexed relationship. A re-export exposes an existing symbol, under the same name or a new one.

If the index has no edge between two names, read the imports and source yourself, and don't claim an inferred link is verified.

Worked example

The caller in demo.ts uses price. Where is the body that runs?

TypeScript
// public.ts
export { basePrice as price } from "./cost";
// cost.ts
export function basePrice(count: number) { return count * 4; }
// demo.ts
import { price } from "./public";
const quoted = price(3);
Predict first, then show the worked explanation

demo.ts imports price from the public module. That module re-exports basePrice under the name price. The function body is in cost.ts. So: search for the public name, follow the re-export, then read the body.

Practice and check

Guided practice

Practice, not scored

Suppose line 2 instead read export { basePrice as price } from "./prices";, and prices.ts held only export { basePrice } from "./cost";. Which file holds the body now?

Choose one answer

Exit check

Counts toward completion

The task asks for the call site, not the definition. Select the line that calls the function.

Select one line

Common mistake

Assuming "references" means "runtime calls". A reference can be a type, an alias, or a function passed as a value.

Practice on a real repository

Try the symbol navigation in the puzzle below. No answer path is supplied: start from its prompt.

Related topics: Code structure

Practice is optional. Solving a puzzle doesn't complete a lesson, and lessons never change a puzzle's points.

References