15 lines
373 B
TypeScript
15 lines
373 B
TypeScript
// @declaration: true
|
|
export interface Point {
|
|
readonly x: number;
|
|
readonly y: number;
|
|
}
|
|
|
|
export interface Rect<p extends Point> {
|
|
readonly a: p;
|
|
readonly b: p;
|
|
}
|
|
|
|
export const Point = (x: number, y: number): Point => ({ x, y });
|
|
export const Rect = <p extends Point>(a: p, b: p): Rect<p> => ({ a, b });
|
|
|
|
Point.zero = (): Point => Point(0, 0); |