Skip to content

Instantly share code, notes, and snippets.

@darkf
Created March 26, 2016 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkf/355b26c0dbeae40a4d4e to your computer and use it in GitHub Desktop.
Save darkf/355b26c0dbeae40a4d4e to your computer and use it in GitHub Desktop.
interface Point2D {
x: number;
y: number;
}
interface Point3D extends Point2D {
z: number;
}
function f(pt: Point2D) {}
let pt: Point3D = {x:1, y:2, z:3};
f(pt); // oh hey it works on 3d points too!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment