Skip to content

Commit e8a3217

Browse files
authored
Merge pull request #591 from nilslindemann/patch-1
Typo fixes
2 parents 07d34ab + 2f2276b commit e8a3217

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/styleguide/styleguide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# TypeScript StyleGuide and Coding Conventions
1+
# TypeScript Style Guide and Coding Conventions
22

3-
> An unofficial TypeScript StyleGuide
3+
> An unofficial TypeScript Style Guide
44
5-
People have asked me for my opinions on this. Personally I don't enforce these a lot on my teams and projects but it does help to have these mentioned as a tie breaker when someone feels the need to have such strong consistency. There are other things that I feel much more strongly about and those are covered in the [tips chapter](../tips/main.md) (e.g. type assertion is bad, property setters are bad) 🌹.
5+
People have asked me for my opinions on this. Personally I don't enforce these a lot on my teams and projects but it does help to have these mentioned as a tiebreaker when someone feels the need to have such strong consistency. There are other things that I feel much more strongly about and those are covered in the [tips chapter](../tips/main.md) (e.g. type assertion is bad, property setters are bad) 🌹.
66

77
Key Sections:
88

@@ -170,7 +170,7 @@ let foo = {x:123,y:undefined};
170170
let foo:{x:number,y?:number} = {x:123};
171171
```
172172

173-
* Use `undefined` in general (do consider returning an object like `{valid:boolean,value?:Foo}` instead)
173+
* Use `undefined` in general (do consider returning an object like `{valid:boolean, value?:Foo}` instead)
174174

175175
***Bad***
176176
```ts
@@ -181,7 +181,7 @@ return null;
181181
return undefined;
182182
```
183183

184-
* Use `null` where its a part of the API or conventional
184+
* Use `null` where it's a part of the API or conventional
185185

186186
> Reason: It is conventional in Node.js e.g. `error` is `null` for NodeBack style callbacks.
187187
@@ -205,7 +205,7 @@ if (error === null)
205205
if (error)
206206
```
207207

208-
* Use `== null` / `!= null` (not `===` / `!==`) to check for `null` / `undefined` on primitives as it works for both `null`/`undefined` but not other falsy values (like `''`,`0`,`false`) e.g.
208+
* Use `== null` / `!= null` (not `===` / `!==`) to check for `null` / `undefined` on primitives as it works for both `null`/`undefined` but not other falsy values (like `''`, `0`, `false`) e.g.
209209

210210
**Bad**
211211
```ts
@@ -219,7 +219,7 @@ if (error != null) // rules out both null and undefined
219219
## Formatting
220220
The TypeScript compiler ships with a very nice formatting language service. Whatever output it gives by default is good enough to reduce the cognitive overload on the team.
221221

222-
Use [`tsfmt`](https://github.com/vvakame/typescript-formatter) to automatically format your code on the command line. Also your IDE (atom/vscode/vs/sublime) already has formatting support built-in.
222+
Use [`tsfmt`](https://github.com/vvakame/typescript-formatter) to automatically format your code on the command line. Also, your IDE (atom/vscode/vs/sublime) already has formatting support built-in.
223223

224224
Examples:
225225
```ts
@@ -231,7 +231,7 @@ const foo: string = "hello";
231231

232232
* Prefer single quotes (`'`) unless escaping.
233233

234-
> Reason: More JavaScript teams do this (e.g. [airbnb](https://github.com/airbnb/javascript), [standard](https://github.com/feross/standard), [npm](https://github.com/npm/npm), [node](https://github.com/nodejs/node), [google/angular](https://github.com/angular/angular/), [facebook/react](https://github.com/facebook/react)). Its easier to type (no shift needed on most keyboards). [Prettier team recommends single quotes as well](https://github.com/prettier/prettier/issues/1105)
234+
> Reason: More JavaScript teams do this (e.g. [airbnb](https://github.com/airbnb/javascript), [standard](https://github.com/feross/standard), [npm](https://github.com/npm/npm), [node](https://github.com/nodejs/node), [google/angular](https://github.com/angular/angular/), [facebook/react](https://github.com/facebook/react)). It's easier to type (no shift needed on most keyboards). [Prettier team recommends single quotes as well](https://github.com/prettier/prettier/issues/1105)
235235
236236
> Double quotes are not without merit: Allows easier copy paste of objects into JSON. Allows people to use other languages to work without changing their quote character. Allows you to use apostrophes e.g. `He's not going.`. But I'd rather not deviate from where the JS Community is fairly decided.
237237
@@ -255,7 +255,7 @@ const foo: string = "hello";
255255

256256
* Annotate arrays as `foos:Foo[]` instead of `foos:Array<Foo>`.
257257

258-
> Reasons: Its easier to read. Its used by the TypeScript team. Makes easier to know something is an array as the mind is trained to detect `[]`.
258+
> Reasons: It's easier to read. It's used by the TypeScript team. Makes easier to know something is an array as the mind is trained to detect `[]`.
259259
260260
## Filename
261261
Name files with `camelCase`. E.g. `accordion.tsx`, `myControl.tsx`, `utils.ts`, `map.ts` etc.
@@ -269,7 +269,7 @@ Name files with `camelCase`. E.g. `accordion.tsx`, `myControl.tsx`, `utils.ts`,
269269
```
270270
type Foo = number | { someProperty: number }
271271
```
272-
* Use `interface` when you want `extends` or `implements` e.g
272+
* Use `interface` when you want `extends` or `implements` e.g.
273273

274274
```
275275
interface Foo {

0 commit comments

Comments
 (0)