Skip to content

Commit 6cdb60b

Browse files
author
Andrew Zheng
committed
Grammar fix, replace lets with let's
1 parent 76eb248 commit 6cdb60b

File tree

12 files changed

+34
-34
lines changed

12 files changed

+34
-34
lines changed

docs/compiler/binder-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Note: `locals` is defined on `Node` and is of type `SymbolTable`. Note that `Sou
99
TIP: local functions are used heavily within the TypeScript compiler. A local function very likely uses variables from the parent function (captured by closure). In the case of `bind` (a local function within `bindSourceFile`) it (or function it calls) will setup the `symbolCount` and `classifiableNames` among others, that are then stored on the returned `SourceFile`.
1010

1111
#### `bind`
12-
Bind takes any `Node` (not just `SourceFile`). First thing it does is assign the `node.parent` (if `parent` variable has been setup ... which again is something the binder does during its processing within the `bindChildren` function), then hands off to `bindWorker` which does the *heavy* lifting. Finally it calls `bindChildren` (a function that simply stores the binder state e.g. current `parent` within its function local vars, then calls `bind` on each child, and then restores the binder state). Now lets look at `bindWorker` which is the more interesting function.
12+
Bind takes any `Node` (not just `SourceFile`). First thing it does is assign the `node.parent` (if `parent` variable has been setup ... which again is something the binder does during its processing within the `bindChildren` function), then hands off to `bindWorker` which does the *heavy* lifting. Finally it calls `bindChildren` (a function that simply stores the binder state e.g. current `parent` within its function local vars, then calls `bind` on each child, and then restores the binder state). Now let's look at `bindWorker` which is the more interesting function.
1313

1414
#### `bindWorker`
1515
This function switches on `node.kind` (of type `SyntaxKind`) and delegates work to the appropriate `bindFoo` function (also defined within `binder.ts`). For example if the `node` is a `SourceFile` it calls (eventually and only if its an external file module) `bindAnonymousDeclaration`

docs/enums.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ col = 0; // Effectively same as Color.Red
3939
```
4040

4141
#### Enums and Strings
42-
Before we look further into enums lets look at the JavaScript that it generates, here is a sample TypeScript:
42+
Before we look further into enums let's look at the JavaScript that it generates, here is a sample TypeScript:
4343

4444
```ts
4545
enum Tristate {
@@ -59,7 +59,7 @@ var Tristate;
5959
})(Tristate || (Tristate = {}));
6060
```
6161

62-
lets focus on the line `Tristate[Tristate["False"] = 0] = "False";`. Within it `Tristate["False"] = 0` should be self explanatory, i.e. sets `"False"` member of `Tristate` variable to be `0`. Note that in JavaScript the assignment operator returns the assigned value (in this case `0`). Therefore the next thing executed by the JavaScript runtime is `Tristate[0] = "False"`. This means that you can use the `Tristate` variable to convert a string version of the enum to a number or a number version of the enum to a string. This is demonstrated below:
62+
let's focus on the line `Tristate[Tristate["False"] = 0] = "False";`. Within it `Tristate["False"] = 0` should be self explanatory, i.e. sets `"False"` member of `Tristate` variable to be `0`. Note that in JavaScript the assignment operator returns the assigned value (in this case `0`). Therefore the next thing executed by the JavaScript runtime is `Tristate[0] = "False"`. This means that you can use the `Tristate` variable to convert a string version of the enum to a number or a number version of the enum to a string. This is demonstrated below:
6363

6464
```ts
6565
enum Tristate {

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ The source for this book is available in the books github repository https://git
4141
// This will be the code under discussion
4242
```
4343

44-
With a dev setup out of the way lets jump into TypeScript syntax.
44+
With a dev setup out of the way let's jump into TypeScript syntax.

docs/javascript/recap.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ TypeScript will try to protect you from portions of JavaScript that never worked
1919
[] + []; // JavaScript will give you "" (which makes little sense), TypeScript will error
2020

2121
//
22-
// other things that are nonsensical in JavaScript
22+
// other things that are nonsensical in JavaScript
2323
// - don't give a runtime error (making debugging hard)
2424
// - but TypeScript will give a compile time error (making debugging unnecessary)
2525
//
2626
{} + []; // JS : 0, TS Error
27-
[] + {}; // JS : "[object Object]", TS Error
27+
[] + {}; // JS : "[object Object]", TS Error
2828
{} + {}; // JS : NaN, TS Error
2929
"hello" - 1; // JS : NaN, TS Error
3030

3131
function add(a,b) {
32-
return
32+
return
3333
a + b; // JS : undefined, TS Error 'unreachable code detected'
3434
}
3535
```
@@ -38,4 +38,4 @@ Essentially TypeScript is linting JavaScript. Just doing a better job at it than
3838

3939
## You still need to learn JavaScript
4040

41-
That said TypeScript is very pragmatic about the fact that *you do write JavaScript* so there are some things about JavaScript that you still need to know in order to not be caught off-guard. Lets discuss them next.
41+
That said TypeScript is very pragmatic about the fact that *you do write JavaScript* so there are some things about JavaScript that you still need to know in order to not be caught off-guard. Let's discuss them next.

docs/options/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
There are a few things that TypeScript prevents you from doing out of the box e.g using a variable that *isn't ever declared* (of course you can use a *declaration file* for external systems).
44

5-
That said, traditionally programming languages have a hard boundary between what is and isn't allowed by the type system. TypeScript is different in that it gives you control on where you put the slider. This is really to allow you to use the JavaScript you know and love with as much safety as **you** want. There are lot of compiler options to control exactly this slider so lets have a look.
5+
That said, traditionally programming languages have a hard boundary between what is and isn't allowed by the type system. TypeScript is different in that it gives you control on where you put the slider. This is really to allow you to use the JavaScript you know and love with as much safety as **you** want. There are lot of compiler options to control exactly this slider so let's have a look.
66

77

88
### Boolean Options
@@ -25,4 +25,4 @@ tsc --someBooleanOption
2525

2626
> All of these are `false` by default.
2727
28-
Click [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to see all compiler options.
28+
Click [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to see all compiler options.

docs/promise.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The `Promise` class is something that exists in many modern JavaScript engines a
44

55
### Callback style code
66

7-
In order to fully appreciate promises lets present a simple sample that proves the difficulty of creating reliable Async code with just callbacks. Consider the simple case of authoring an async version of loading JSON from a file. A synchronous version of this can be quite simply
7+
In order to fully appreciate promises let's present a simple sample that proves the difficulty of creating reliable Async code with just callbacks. Consider the simple case of authoring an async version of loading JSON from a file. A synchronous version of this can be quite simply
88

99
```ts
1010
import fs = require('fs');
@@ -129,7 +129,7 @@ loadJSON('good.json', function (err, data) {
129129

130130
if (err) console.log('Error:', err.message);
131131
else {
132-
// lets simulate an error by trying to access a property on an undefined variable
132+
// let's simulate an error by trying to access a property on an undefined variable
133133
var foo;
134134
// The following code throws `Error: Cannot read property 'bar' of undefined`
135135
console.log(foo.bar);
@@ -176,7 +176,7 @@ A promise can be either `pending` or `resolved` or `rejected`.
176176

177177
![](https://raw.githubusercontent.com/basarat/typescript-book/master/images/promise%20states%20and%20fates.png)
178178

179-
Lets look at creating a promise. Its a simple matter of calling `new` on `Promise` (the promise constructor). The promise constructor is passed `resolve` and `reject` functions for settling the promise state.
179+
Let's look at creating a promise. Its a simple matter of calling `new` on `Promise` (the promise constructor). The promise constructor is passed `resolve` and `reject` functions for settling the promise state.
180180

181181
```ts
182182
const promise = new Promise((resolve, reject) => {
@@ -255,7 +255,7 @@ Promise.reject(new Error('something bad happened'))
255255
return 123;
256256
})
257257
.catch((err) => {
258-
console.log(err.message); // something bad happened
258+
console.log(err.message); // something bad happened
259259
});
260260
```
261261

@@ -344,7 +344,7 @@ Just wrap the function call in a promise and
344344
- `reject` if an error occurs,
345345
- `resolve` if it is all good.
346346

347-
E.g. lets wrap `fs.readFile`
347+
E.g. let's wrap `fs.readFile`
348348

349349
```ts
350350
import fs = require('fs');
@@ -414,7 +414,7 @@ function loadItem(id: number): Promise<{id: number}> {
414414
console.log('loading item', id);
415415
setTimeout(() => { // simulate a server delay
416416
resolve({ id: id });
417-
}, 1000);
417+
}, 1000);
418418
});
419419
}
420420

@@ -434,7 +434,7 @@ loadItem(1)
434434
Promise.all([loadItem(1),loadItem(2)])
435435
.then((res) => {
436436
[item1,item2] = res;
437-
console.log('done')
437+
console.log('done')
438438
}); // overall time will be around 1s
439439
```
440440

docs/tips/defaultIsBad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## `export default` can lead to problems
22

3-
Lets go with an example. Consider you have a file `foo.ts` with the following contents:
3+
Let's go with an example. Consider you have a file `foo.ts` with the following contents:
44

55
```ts
66
class Foo {

docs/types/ambient/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ process.exitWithLogging = function() {
3434
}
3535
```
3636

37-
Lets look at interfaces in a bit more detail next.
37+
Let's look at interfaces in a bit more detail next.

docs/types/index-signatures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let foo = ['World'];
4949
console.log(foo[0]); // World
5050
```
5151

52-
So that's JavaScript. Now lets look at TypeScript graceful handling of this concept.
52+
So that's JavaScript. Now let's look at TypeScript graceful handling of this concept.
5353

5454
## TypeScript Index Signature
5555

@@ -100,7 +100,7 @@ So lesson 1:
100100

101101
> TypeScript index signatures must be either `string` or `number`
102102
103-
Quick note: `symbols` are also valid and supported by TypeScript. But lets not go there just yet. Baby steps.
103+
Quick note: `symbols` are also valid and supported by TypeScript. But let's not go there just yet. Baby steps.
104104

105105

106106
### Declaring an index signature

docs/types/lib.d.ts.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can exclude this file from the compilation context by specifying the `--noLi
1717

1818
### Example Usage
1919

20-
As always lets look at examples of this file being used in action.
20+
As always let's look at examples of this file being used in action.
2121

2222
```ts
2323
var foo = 123;
@@ -39,7 +39,7 @@ The contents of `lib.d.ts` are primarily a bunch of *variable* declarations e.g.
3939

4040
The simplest way to discover what is what is to type in code *that you know works* e.g. `Math.floor` and then F12 (go to definition) using your IDE (atom-typescript has great support for this).
4141

42-
Lets look at a sample *variable* declaration, e.g. `window` is defined as:
42+
Let's look at a sample *variable* declaration, e.g. `window` is defined as:
4343
```ts
4444
declare var window: Window;
4545
```
@@ -223,24 +223,24 @@ However if you want finer grained control of your environment you should use the
223223

224224
Sometimes (many times) you want to decouple the relationship between the compile target (the generates JavaScript version) and the ambient library support. A common example is `Promise`, e.g today (in June 2016) you most likely want to `--target es5` but still use latest stuff like `Promise`. To support this you can take explicit control of `lib` using the `lib` compiler option.
225225

226-
> Note: using `--lib` decouples any lib magic from `--target` giving you better control.
226+
> Note: using `--lib` decouples any lib magic from `--target` giving you better control.
227227
228-
You can provide this option on the command line or in `tsconfig.json` (recommended):
228+
You can provide this option on the command line or in `tsconfig.json` (recommended):
229229

230230
**Command line**:
231231
```
232232
tsc --target es5 --lib dom,es6
233-
```
234-
**tsconfig.json**:
233+
```
234+
**tsconfig.json**:
235235
```json
236236
"compilerOptions": {
237237
"lib": ["dom", "es6"]
238238
}
239239
```
240240

241-
The libs can be categorized into categories:
241+
The libs can be categorized into categories:
242242

243-
* JavaScript Bulk Feature:
243+
* JavaScript Bulk Feature:
244244
* es5
245245
* es6
246246
* es2015
@@ -268,11 +268,11 @@ The libs can be categorized into categories:
268268

269269
> NOTE: the `--lib` option provides extremely fine tuned control. So you most likey want to pick an item from the bulk + enviroment categories.
270270
271-
My Personal Recommentation:
271+
My Personal Recommentation:
272272

273273
```json
274274
"compilerOptions": {
275275
"target": "es5",
276276
"lib": ["es6", "dom"]
277277
}
278-
```
278+
```

0 commit comments

Comments
 (0)