Skip to content

Commit 77b8634

Browse files
committed
no message
1 parent 03321f5 commit 77b8634

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/why-typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ Types have proven ability to enhance code quality and understandability. Large t
1717
However types have a way of being unnecessarily ceremonious. TypeScript is very particular about keeping the barrier to entry as low as possible. Here's how:
1818

1919
### Your JavaScript is TypeScript
20-
TypeScript provides compile time Type safety for your JavaScript code. This is no surprise given its name. The great thing is that the types are completely optional. Your JavaScript code `.js` file can be renamed to a `.ts` file and TypeScript will still give you back valid `.js` equivalent to the original JavaScript file. TypeScript is *intentionally* and strictly a superset of JavaScript with optional Type checking.
20+
TypeScript provides compile time type safety for your JavaScript code. This is no surprise given its name. The great thing is that the types are completely optional. Your JavaScript code `.js` file can be renamed to a `.ts` file and TypeScript will still give you back valid `.js` equivalent to the original JavaScript file. TypeScript is *intentionally* and strictly a superset of JavaScript with optional Type checking.
2121

2222
### Types can be Implicit
23-
TypeScript will try to infer as much of the Type information as it can in order to give you type safety with minimal cost of productivity during code development. For example, in the following example TypeScript will know that foo is of type `number` below and will give an error on the second line as shown:
23+
TypeScript will try to infer as much of the type information as it can in order to give you type safety with minimal cost of productivity during code development. For example, in the following example TypeScript will know that foo is of type `number` below and will give an error on the second line as shown:
2424

2525
```ts
2626
var foo = 123;
2727
foo = '456'; // Error: cannot assign `string` to `number`
2828

2929
// Is foo a number or a string?
3030
```
31-
This type inference is well motivated. If you do stuff like this, in the rest of your code you cannot be certain that `foo` is a `number` or a `string`. Such issues turn up often in large multi-file code bases. We will deep dive into the type inference rules later.
31+
This type inference is well motivated. If you do stuff like shown in this example, then, in the rest of your code, you cannot be certain that `foo` is a `number` or a `string`. Such issues turn up often in large multi-file code bases. We will deep dive into the type inference rules later.
3232

3333
### Types can be Explicit
3434
As we've mentioned before, TypeScript will infer as much as it can safely, however you can use annotations to:

0 commit comments

Comments
 (0)