summaryrefslogtreecommitdiffhomepage
path: root/typescript.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'typescript.html.markdown')
-rw-r--r--typescript.html.markdown8
1 files changed, 5 insertions, 3 deletions
diff --git a/typescript.html.markdown b/typescript.html.markdown
index 1d712369..d3ca0786 100644
--- a/typescript.html.markdown
+++ b/typescript.html.markdown
@@ -13,7 +13,7 @@ This article will focus only on TypeScript extra syntax, as opposed to [JavaScri
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.
-```js
+```ts
// There are 3 basic types in TypeScript
var isDone: boolean = false;
var lines: number = 42;
@@ -46,10 +46,12 @@ function bigHorribleAlert(): void {
var f1 = function(i: number): number { return i * i; }
// Return type inferred
var f2 = function(i: number) { return i * i; }
+// "Fat arrow" syntax
var f3 = (i: number): number => { return i * i; }
-// Return type inferred
+// "Fat arrow" syntax with return type inferred
var f4 = (i: number) => { return i * i; }
-// Return type inferred, one-liner means no return keyword needed
+// "Fat arrow" syntax with return type inferred, braceless means no return
+// keyword needed
var f5 = (i: number) => i * i;
// Interfaces are structural, anything that has the properties is compliant with