Merge pull request #3313 from bradleyjkemp/patch-1

[typescript/en] Add example of "implements" keyword
This commit is contained in:
Divay Prakash 2018-10-21 16:29:38 +05:30 committed by GitHub
commit efeb47da27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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