Skip to content

Commit f0726bf

Browse files
authored
Merge pull request #40 from gdarchen/fix/typos
fix(typos): fix some typos found in the book content
2 parents f3120fb + 9f55f6c commit f0726bf

9 files changed

+15
-15
lines changed

book-content/chapters/04-essential-types-and-annotations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ type ShoppingCart = {
11861186

11871187
There are a few different ways to express an array of objects.
11881188

1189-
One approach would be to to create a new `Ingredient` type that we can use to represent the objects in the array:
1189+
One approach would be to create a new `Ingredient` type that we can use to represent the objects in the array:
11901190

11911191
```ts twoslash
11921192
type Ingredient = {

book-content/chapters/07-mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,6 @@ const buttonsToChange: (
10081008
)[];
10091009
```
10101010
1011-
But again, this is still typed strongly enough to to satisfy `modifyButtons`.
1011+
But again, this is still typed strongly enough to satisfy `modifyButtons`.
10121012
10131013
When using `as const` like this acts like a hint to TypeScript that it should infer a literal type where it wouldn't otherwise. This can be occasionally useful for when you want to allow mutation, but still want to infer a literal type.

book-content/chapters/10-deriving-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Use the `typeof` keyword whenever you need to extract types based on runtime val
196196

197197
### You Can't Create Runtime Types from Values
198198

199-
We've seen that `typeof` can create types from runtime values, but it's important to note that there is no way to to create a value from a type.
199+
We've seen that `typeof` can create types from runtime values, but it's important to note that there is no way to create a value from a type.
200200

201201
In other words, there is no `valueof` operator:
202202

@@ -559,7 +559,7 @@ Your task is to update the `Environment` type so that it is derived from the `co
559559

560560
### Exercise 3: Accessing Specific Values
561561

562-
Here were have an `programModeEnumMap` object that keeps different groupings in sync. There is also a `ProgramModeMap` type that uses `typeof` to represent the entire enum mapping:
562+
Here we have an `programModeEnumMap` object that keeps different groupings in sync. There is also a `ProgramModeMap` type that uses `typeof` to represent the entire enum mapping:
563563

564564
```typescript
565565
export const programModeEnumMap = {

book-content/chapters/11-annotations-and-assertions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ This allows us to specify that the values we pass to our configuration object mu
10341034

10351035
Let's work through the solutions for `satisfies`, `as`, and variable annotations.
10361036

1037-
#### When to Use `satifies`
1037+
#### When to Use `satisfies`
10381038

10391039
For the first scenario that uses a `Record`, the `satisfies` keyword won't work because we can't add dynamic members to an empty object.
10401040

@@ -1193,4 +1193,4 @@ const routes = {
11931193

11941194
Now our tests pass expected.
11951195

1196-
This setup of combining `as const` and `satisfies` is ideal when you need a particular shape for a configuration object and want while enforcing immutability.
1196+
This setup of combining `as const` and `satisfies` is ideal when you need a particular shape for a configuration object while enforcing immutability.

book-content/chapters/12-the-weird-parts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ playSong(Song);
460460

461461
In this case, TypeScript shows an error when we try to pass the `Song` class itself to the `playSong` function. This is because `Song` is a class, and not an instance of the class.
462462

463-
So, classes exists in both the type and value worlds, and represents an instance of the class when used as a type.
463+
So, classes exist in both the type and value worlds, and represent an instance of the class when used as a type.
464464

465465
### Enums
466466

book-content/chapters/13-modules-scripts-declaration-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,12 @@ declare module "duration-utils" {
383383

384384
We use `export` to define what is being exported from the module.
385385

386-
Like before, we are not including any implementation code in the `.d.ts` file– it's just the types that are being declared.
386+
Like before, we are not including any implementation code in the `.d.ts` file – it's just the types that are being declared.
387387

388388
Once the `duration-utils.d.ts` file is created, the module can be imported and used as usual:
389389

390390
```typescript
391-
import { formatDuration, parseTrackData } from "music-utils";
391+
import { formatDuration, parseTrackData } from "duration-utils";
392392

393393
const formattedTime = formatDuration(309);
394394
```
@@ -468,7 +468,7 @@ const numbers = [1, 2, 3];
468468
numbers.map((n) => n * 2);
469469
```
470470

471-
Let's step back for a minute. How does TypeScript know that `.map` exists on an array? How does it know that `.map` exists, but `.transform` doesn't? Where is this defined
471+
Let's step back for a minute. How does TypeScript know that `.map` exists on an array? How does it know that `.map` exists, but `.transform` doesn't? Where is this defined?
472472

473473
As it turns out, TypeScript ships with a bunch of declaration files that describe the JavaScript environment. We can do a 'go to definition' on `.map` to see where that is:
474474

book-content/chapters/14-configuring-typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ The common settings can be moved to `tsconfig.base.json`:
909909
}
910910
```
911911

912-
Then, the `client/tsconfig.json` would extend the base configuration wit the `extends` option that points to the `tsconfig.base.json` file:
912+
Then, the `client/tsconfig.json` would extend the base configuration with the `extends` option that points to the `tsconfig.base.json` file:
913913

914914
```tsx
915915
// client/tsconfig.json

book-content/chapters/15-designing-your-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ TypeScript shows an error that tells us that `ResourceStatus` requires two type
232232

233233
In some cases, you may want to provide default types for generic type parameters. Like with functions, you can use the `=` to assign a default value.
234234

235-
By setting `TMetadata`'s default value to an empty, we can essentially make `TMetadata` optional:
235+
By setting `TMetadata`'s default value to an empty object, we can essentially make `TMetadata` optional:
236236

237237
```tsx
238238
type ResourceStatus<TContent, TMetadata = {}> =
@@ -549,7 +549,7 @@ Conditional types turn TypeScript's type system into a full programming language
549549

550550
## Mapped Types
551551

552-
Mapped types in TypeScript allow you to create a new object type based on an existing type by iterating over its keys and values. This can be let you be extremely expressive when creating new object types.
552+
Mapped types in TypeScript allow you to create a new object type based on an existing type by iterating over its keys and values. This can let you be extremely expressive when creating new object types.
553553

554554
Consider this `Album` interface:
555555

book-content/chapters/16-the-utils-folder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ it("should return the result if the function succeeds", async () => {
957957
});
958958
```
959959

960-
Your task is to update `safeFunction` to have a generic type parameter, and update `PromiseFunc` to not return `Promise<Any>`. This will require you to combine generic types and functions to ensure that the tests pass successfully.
960+
Your task is to update `safeFunction` to have a generic type parameter, and update `PromiseFunc` to not return `Promise<any>`. This will require you to combine generic types and functions to ensure that the tests pass successfully.
961961

962962
<Exercise title="Exercise 5: Combining Generic Types and Functions" filePath="/src/085-the-utils-folder/219-combining-generic-types-with-generic-functions.problem.ts"></Exercise>
963963

@@ -1197,7 +1197,7 @@ const objMap = createStringMap();
11971197
const objMap: Map<string, unknown>;
11981198
```
11991199

1200-
Through these steps, we've successfully transformed `createStringMap` from a regular function into a generic function capable of receiving type arguments .
1200+
Through these steps, we've successfully transformed `createStringMap` from a regular function into a generic function capable of receiving type arguments.
12011201

12021202
### Solution 2: Default Type Arguments
12031203

0 commit comments

Comments
 (0)