mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Updating the line length to 80
This commit is contained in:
parent
dc52cc8ee9
commit
a41c5d77c2
@ -5,13 +5,19 @@ contributors:
|
|||||||
filename: learntypescript.ts
|
filename: learntypescript.ts
|
||||||
---
|
---
|
||||||
|
|
||||||
TypeScript is a language that aims at easing development of large scale applications written in JavaScript.
|
TypeScript is a language that aims at easing development of large scale
|
||||||
TypeScript adds common concepts such as classes, modules, interfaces, generics and (optional) static typing to JavaScript.
|
applications written in JavaScript. TypeScript adds common concepts such as
|
||||||
It is a superset of JavaScript: all JavaScript code is valid TypeScript code so it can be added seamlessly to any project. The TypeScript compiler emits JavaScript.
|
classes, modules, interfaces, generics and (optional) static typing to
|
||||||
|
JavaScript. It is a superset of JavaScript: all JavaScript code is valid
|
||||||
|
TypeScript code so it can be added seamlessly to any project. The TypeScript
|
||||||
|
compiler emits JavaScript.
|
||||||
|
|
||||||
This article will focus only on TypeScript extra syntax, as opposed to [JavaScript](/docs/javascript).
|
This article will focus only on TypeScript extra syntax, as opposed to
|
||||||
|
[JavaScript](/docs/javascript).
|
||||||
|
|
||||||
To test TypeScript's compiler, head to the [Playground] (http://www.typescriptlang.org/Playground) where you will be able to type code, have auto completion and directly see the emitted JavaScript.
|
To test TypeScript's compiler, head to the
|
||||||
|
[Playground] (http://www.typescriptlang.org/Playground) where you will be able
|
||||||
|
to type code, have auto completion and directly see the emitted JavaScript.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
// There are 3 basic types in TypeScript
|
// There are 3 basic types in TypeScript
|
||||||
@ -19,7 +25,8 @@ let isDone: boolean = false;
|
|||||||
let lines: number = 42;
|
let lines: number = 42;
|
||||||
let name: string = "Anders";
|
let name: string = "Anders";
|
||||||
|
|
||||||
// But you can omit the type annotation if the variables are derived from explicit literals
|
// But you can omit the type annotation if the variables are derived
|
||||||
|
// from explicit literals
|
||||||
let isDone = false;
|
let isDone = false;
|
||||||
let lines = 42;
|
let lines = 42;
|
||||||
let name = "Anders";
|
let name = "Anders";
|
||||||
@ -114,7 +121,7 @@ class Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classes can be explicitly marked as implementing an interface.
|
// Classes can be explicitly marked as implementing an interface.
|
||||||
// Any missing properties will then cause an error at compile-time.
|
// Any missing properties will then cause an error at compile-time.
|
||||||
class PointPerson implements Person {
|
class PointPerson implements Person {
|
||||||
name: string
|
name: string
|
||||||
move() {}
|
move() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user