summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--typescript.html.markdown5
1 files changed, 5 insertions, 0 deletions
diff --git a/typescript.html.markdown b/typescript.html.markdown
index f8e78d44..24d1db10 100644
--- a/typescript.html.markdown
+++ b/typescript.html.markdown
@@ -72,6 +72,11 @@ let f4 = (i: number) => { return i * i; }
// keyword needed
let f5 = (i: number) => i * i;
+// Functions can accept more than one type
+function f6(i: string | number): void {
+ console.log("The value was " + i);
+}
+
// Interfaces are structural, anything that has the properties is compliant with
// the interface
interface Person {