Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small feedback #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions book-content/chapters/11-annotations-and-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down