Skip to lesson
Exit
Multiline, imports and cross-file portals1 / 1

2 min lesson

Tab multiline and portal jumps

Practice Multiline and cross-file Tab review on one real case. Check the result before moving on.

Check your understanding

Complete the practice "Rename a field with Tab, then follow the portal into its caller".

Outcome: The type check passes. Every amountMinor reference resolves across both files, and no other file changed.

Rename a field with Tab, then follow the portal into its caller
Tab multiline and portal jumps
SayI'll make the first rename myself by changing amount to amountMinor on the Money type. This gives Tab a concrete pattern to continue.
DoChange the field by hand in the type definition and its first usage in money.ts.
TypeTab suggests the same rename across the remaining amount references in money.ts as one multiline edit.
DoRead every highlighted line before pressing Tab.
SeeThe edit touches only the intended references inside money.ts. It does not change an unrelated file, so you accept it.
DoFollow the portal into invoice.ts. Confirm that it is the caller you expected before accepting the cross-file edit.
SeeCursor shows a portal jump to src/invoice.ts and predicts the same rename where Money is constructed.
DoRun tsc --noEmit. This is the smallest check that catches a broken reference across money.ts and invoice.ts.
SeeThe type check passes. Every amountMinor reference resolves across both files, and no other file changed.
Learn more

Optional practice

Test yourself on Tab multiline and portal jumps

QWhat should be true when you finish the Multiline and cross-file Tab review practice?

Finish the check to continue.