Skip to content

Commit f5a1fdf

Browse files
authored
Merge pull request #30 from ChocolateNao/typo-fix
Fixed typos and grammar
2 parents 0d265c4 + b136b67 commit f5a1fdf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

book-content/chapters/09-typescript-only-features.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Based on what I've told you so far, you might be thinking of TypeScript as just
44

55
But TypeScript actually has a few runtime features that don't exist in JavaScript. These features are compiled into JavaScript, but they are not part of the JavaScript language itself.
66

7-
In this chapter we'll look at several of these TypesScript-only features, including parameter properties, enums and namespaces. Along the way, we'll discuss benefits and trade-offs, as well as when you might want to stick with JavaScript.
7+
In this chapter we'll look at several of these TypeScript-only features, including parameter properties, enums and namespaces. Along the way, we'll discuss benefits and trade-offs, as well as when you might want to stick with JavaScript.
88

99
## Class Parameter Properties
1010

@@ -18,7 +18,7 @@ class Rating {
1818
}
1919
```
2020

21-
That the constructor includes `public` before the `value` prameter and `private` before the `max` parameter. In JavaScript, this compiles down to code which assigns the parameters to properties on the class:
21+
That the constructor includes `public` before the `value` parameter and `private` before the `max` parameter. In JavaScript, this compiles down to code which assigns the parameters to properties on the class:
2222

2323
```typescript
2424
class Rating {
@@ -471,7 +471,7 @@ This information will become crucial later when we look at the namespace's key u
471471

472472
Imagine ES modules, with `import` and `export`, never existed. In this world, everything you declare is in the global scope. You'd have to be careful about naming things, and you'd have to come up with a way to organize your code.
473473

474-
This is the world that TypeScript was born into. Module systems like CommonJS (`requre`) and ES Modules (`import`, `export`) weren't popular yet. So, namespaces were a crucial way to avoid naming conflicts and organize your code.
474+
This is the world that TypeScript was born into. Module systems like CommonJS (`require`) and ES Modules (`import`, `export`) weren't popular yet. So, namespaces were a crucial way to avoid naming conflicts and organize your code.
475475

476476
But now that ES modules are widely supported, you should use them over namespaces. Namespaces have very little relevance in modern TypeScript code, with some exceptions which we'll explore in our chapter on global scopes.
477477

@@ -493,4 +493,4 @@ But the question remains: should you use them? TypeScript will likely never stop
493493

494494
But I prefer writing code in the spirit of the language I'm using. Writing "JavaScript with types" keeps the relationship between TypeScript and JavaScript crystal-clear.
495495

496-
However, this is my personal preference. If you're working on a large codebase that already uses these features, it is _not_ worth the effort to remove them. Reaching a decision as a team, and staying consistent, is the key.
496+
However, this is my personal preference. If you're working on a large codebase that already uses these features, it is _not_ worth the effort to remove them. Reaching a decision as a team and staying consistent are the keys.

0 commit comments

Comments
 (0)