Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Point2D {
- x: number;
- y: number;
- }
- interface Point3D {
- x: number;
- y: number;
- z: number;
- }
- var point2D: Point2D = { x: 0, y: 10 }
- var point3D: Point3D = { x: 0, y: 10, z: 20 }
- function iTakePoint2D(point: Point2D) { /* do something */ }
- iTakePoint2D(point2D); // exact match okay
- iTakePoint2D(point3D); // extra information okay
- iTakePoint2D({ x: 0 }); // Error: missing information `y`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement