The Lie at the Boundary

Annotating a response does not check it. It tells the compiler to assume, and the compiler believes you completely.

This is where most TypeScript projects that break in production actually break. Everything inside the application is beautifully typed, and the data entering it was never verified at all.

Try it

That second one is worse than the crash: a plausible wrong value that flows onward. It is exactly the bug from module 1, reintroduced by an assertion.

loading editor…

checking…

No type errors at all. The compiler was told to assume, so it did. At runtime book.title is undefined and toUpperCase throws, and book.year + 1 quietly produces "19791".

✦ as is a promise, not a conversion

It means 'trust me'. It performs no check, converts nothing, and removes the compiler's ability to help. The APIs & Datasets course spent a whole module on what real responses actually look like: missing fields, nulls, a string where a number was documented. None of it is caught by an assertion.

Mark this lesson complete

Signed in, your progress follows you to every device.

Next: Type Guards →
← Back