summaryrefslogtreecommitdiffhomepage
path: root/typescript.html.markdown
diff options
context:
space:
mode:
authorPhilippe <pvlerick@gmail.com>2014-09-01 10:51:43 +0200
committerPhilippe <pvlerick@gmail.com>2014-09-01 10:51:43 +0200
commitef37db634aa8fc1b21a1542c176339f250678cb2 (patch)
tree1b955888de93f8d40a1eb2ab5115d8ee3889fe1e /typescript.html.markdown
parent20e827f2543605f533d1cc4e6d474d3b1fd7bac9 (diff)
Fixed errors and typos
After review from from Nami-Doc
Diffstat (limited to 'typescript.html.markdown')
-rw-r--r--typescript.html.markdown13
1 files changed, 7 insertions, 6 deletions
diff --git a/typescript.html.markdown b/typescript.html.markdown
index 3ba1300d..8173aac8 100644
--- a/typescript.html.markdown
+++ b/typescript.html.markdown
@@ -1,13 +1,13 @@
---
language: TypeScript
contributors:
- - ["Philippe Vlérick", "https://github.com/pvlerick"]]
+ - ["Philippe Vlérick", "https://github.com/pvlerick"]
filename: learntypescript.ts
---
TypeScript is a language that aims at easing development of large scale applications written in JavaScript.
TypeScript adds common concepts such as 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 emitts 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 oposed to [JavaScript] (../javascript/).
@@ -46,7 +46,7 @@ var f3 = (i : number) : number => { return i * i; }
var f4 = (i: number) => { return i * i; } //Return type infered
var f5 = (i: number) => i * i; //Return type infered, one-liner means no return keyword needed
-//Interfaces are structural, anything that has the properties is compliant with the interface (duck typing)
+//Interfaces are structural, anything that has the properties is compliant with the interface
interface Person {
name: string;
//Optional properties, marked with a "?"
@@ -76,8 +76,9 @@ class Point {
//Properties
x: number;
- //Constructor - the public/private keywords in this context are shortcuts to generate the code for a property
- //Equivalent to "x" in this case
+ //Constructor - the public/private keywords in this context will generate the boiler plate code
+ // for the property and the initialization in the constructor.
+ // In this example, "y" will be defined just like "x" is, but with less code
//Default values are also supported
constructor(x: number, public y: number = 0) {
this.x = x;
@@ -106,7 +107,7 @@ class Point3D extends Point {
}
}
-//Modules, "." can be used as separators for sub modules
+//Modules, "." can be used as separator for sub modules
module Geometry {
export class Square {
constructor(public sideLength: number = 0) {