@caveworld/honeycomb-grid
Version:
Create hexagon grids easily
16 lines (15 loc) • 797 B
TypeScript
import { AxialCoordinates, Hex, HexCoordinates, HexSettings } from '../hex';
export declare type Traverser<T extends Hex, R extends Iterable<T> = T[]> = (createHex: (coordinates?: HexCoordinates) => T, cursor?: HexCoordinates) => R;
export interface GridAsJSON<T extends Hex> {
hexSettings: HexSettings & Omit<T, keyof Hex>;
coordinates: AxialCoordinates[];
}
export declare enum Rotation {
CLOCKWISE = "CLOCKWISE",
COUNTERCLOCKWISE = "COUNTERCLOCKWISE"
}
export declare type RotationLike = Rotation | 'CLOCKWISE' | 'clockwise' | 'COUNTERCLOCKWISE' | 'counterclockwise';
export declare type Without<T, U> = {
[P in Exclude<keyof T, keyof U>]?: never;
};
export declare type XOR<T, U> = T | U extends Record<string, unknown> ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;