From 0506808213e8cc470f109cea7ca94735cf9134e8 Mon Sep 17 00:00:00 2001 From: Adam Rackis <adamrackis@hotmail.com> Date: Wed, 31 Jul 2024 00:49:08 -0500 Subject: [PATCH] small feedback --- book-content/chapters/11-annotations-and-assertions.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/book-content/chapters/11-annotations-and-assertions.md b/book-content/chapters/11-annotations-and-assertions.md index 03d9861..e8453fd 100644 --- a/book-content/chapters/11-annotations-and-assertions.md +++ b/book-content/chapters/11-annotations-and-assertions.md @@ -127,6 +127,8 @@ So it seems we're at an impasse. We both want to infer the type of the value, bu The `satisfies` operator is a way to tell TypeScript that a value must satisfy certain criteria, but still allow TypeScript to infer the type. +Maybe mention also that `satisfies` prevents widening? + Let's use it to make sure our `config` object has the right shape: ```typescript @@ -270,6 +272,7 @@ As an alternative to `as`, you can prefix the value with the type wrapped in ang ```typescript const id = <string>searchParams.get("id"); +// this doesn't work in tsx / react files, right? Might be worth mentioning if so ``` This is less common than `as`, but behaves exactly the same way. `as` is more common, so it's better to use that.