2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-03-29 12:51:36 +00:00
|
|
|
export class Point {
|
2024-06-17 03:11:31 +00:00
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
|
|
|
|
constructor(x: number, y: number) {
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
}
|
2022-03-29 12:51:36 +00:00
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
action(...args: any[]): any {
|
|
|
|
return args[0];
|
|
|
|
}
|
|
|
|
toString(): string {
|
|
|
|
return [this.x, this.y].join(", ");
|
|
|
|
}
|
2022-04-26 13:34:42 +00:00
|
|
|
explicitTypes(_x: number, _y: string) {
|
|
|
|
return true;
|
|
|
|
}
|
2022-03-29 12:51:36 +00:00
|
|
|
*[Symbol.iterator](): IterableIterator<number> {
|
|
|
|
yield this.x;
|
|
|
|
yield this.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stringifyPoint(point: Point) {
|
|
|
|
return point.toString();
|
|
|
|
}
|
2022-08-11 03:03:33 +00:00
|
|
|
|
|
|
|
export type PointWithExtra = Point & {
|
|
|
|
nonExistent: () => number;
|
|
|
|
};
|