Skip to content

Commit 6da7c00

Browse files
authored
Merge pull request basarat#171 from blx/master
Fix small typos in null.md
2 parents b1cf4dc + 62b2b21 commit 6da7c00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: docs/tips/null.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
JavaScript (and by extension TypeScript) has two bottom types : `null` and `undefined`. They are *intended* to mean different things:
33

44
* Something hasn't been initialized : `undefined`
5-
* Something is current unavailable: `null`
5+
* Something is currently unavailable: `null`
66

77
Most other languages only have one (commonly called `null`). Since by default JavaScript will evaluate an uninitialized variable / parameter / property to `undefined` (you don't get a choice) we recommend you just use that for your own *unavailable* status and don't bother with `null`.
88

@@ -43,7 +43,7 @@ function foo():{a:number,b?:number}{
4343
```
4444

4545
### Node style callbacks
46-
Node style callback function (e.g. `(err,somethingElse)=>{ /* something */ }`) are generally called with `err` set to `null` if there isn't an error. You generally just use a truthy check for this anyways:
46+
Node style callback functions (e.g. `(err,somethingElse)=>{ /* something */ }`) are generally called with `err` set to `null` if there isn't an error. You generally just use a truthy check for this anyways:
4747

4848
```ts
4949
fs.readFile('someFile', 'utf8', (err,data) => {
@@ -53,7 +53,7 @@ fs.readFile('someFile', 'utf8', (err,data) => {
5353
// no error
5454
});
5555
```
56-
When creating your own APIs its *okay* to use `null` in this case for consistency. In all sincerity for your own APIs you should look at promises, in that case you actually don't need to bother with absent error values (you handle them with `.then` vs. `.catch`).
56+
When creating your own APIs it's *okay* to use `null` in this case for consistency. In all sincerity for your own APIs you should look at promises, in that case you actually don't need to bother with absent error values (you handle them with `.then` vs. `.catch`).
5757

5858
### Don't use `undefined` as a means of denoting *validity*
5959

0 commit comments

Comments
 (0)