summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDivay Prakash <divayprakash@users.noreply.github.com>2018-10-21 16:29:38 +0530
committerGitHub <noreply@github.com>2018-10-21 16:29:38 +0530
commitefeb47da27aec4a74f283a7d7f7b39fa7eb07c98 (patch)
treea7d56e248c6c9e3f2f558886b385d3798d80499a
parent9e2bd7c11bcfce42007c962eb8a9fbbeeb6f12e2 (diff)
parent67730b4e0b3100a7a6df925ef28606b71aa30a43 (diff)
Merge pull request #3313 from bradleyjkemp/patch-1
[typescript/en] Add example of "implements" keyword
-rw-r--r--typescript.html.markdown7
1 files changed, 7 insertions, 0 deletions
diff --git a/typescript.html.markdown b/typescript.html.markdown
index db6579e2..9158f123 100644
--- a/typescript.html.markdown
+++ b/typescript.html.markdown
@@ -113,6 +113,13 @@ class Point {
static origin = new Point(0, 0);
}
+// Classes can be explicitly marked as implementing an interface.
+// Any missing properties will then cause an error at compile-time.
+class PointPerson implements Person {
+ name: string
+ move() {}
+}
+
let p1 = new Point(10, 20);
let p2 = new Point(25); //y will be 0