Skip to content
Learn Netverks

Lesson

Step 9/32 28% through track

any-unknown-never

any, unknown, and never

Last reviewed Jun 1, 2026 Content v20260601
Track mode
client_typescript
Means
In-browser TS
Reading
~1 min
Level
beginner

This lesson

This lesson teaches any, unknown, and never—the ideas, syntax, and habits you need before moving on in TypeScript.

Without a solid grasp of any, unknown, and never, you will repeat mistakes in TypeScript exercises and on real pages or scripts.

You will apply any, unknown, and never in contexts like: Modern front-end apps, Node APIs, and any team that standardizes on TS-first tooling.

Write TypeScript, compile in the browser, run the emitted JavaScript, and check understanding with MCQs.

When the previous lesson's MCQs feel easy and you can explain any, unknown, and never in your own words.

  • any — disables checking; escape hatch only.
  • unknown — safe top type; narrow before use.
  • never — no values; used for impossible branches and throwing functions.

Choosing between them

Use unknown for JSON.parse results and external APIs—force narrowing before use. Reserve any for incremental migrations with a TODO. Use never for functions that always throw or infinite loops.

Interview angle

Teams prefer: “We accept unknown at boundaries and narrow; we avoid any in new code.”

Self-check

  1. Why is unknown safer than any in a library wrapper?

Pitfall: Prefer unknown at boundaries; avoid new any in application code.

Interview prep

unknown vs any?

unknown forces narrowing before use; any disables checking. Prefer unknown at boundaries.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What part of this lesson needs a second read?
  • What would you try differently in a real project?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump