mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
fix(ci): card points re-typed for the non-strict builds, formatting, strict ratchet and two assistant e2e checks
This commit is contained in:
@@ -17,8 +17,9 @@ export const cardLngSchema = z.number().min(-180).max(180);
|
||||
|
||||
/** A point of a line to draw, `[lat, lng]` at five decimals; single points are `{ lat, lng }` objects. */
|
||||
export type CardPoint = [number, number];
|
||||
// Typed by hand: server and client compile without strictNullChecks, where an inferred tuple makes every item optional.
|
||||
export const cardPointSchema: z.ZodType<CardPoint> = z.tuple([cardLatSchema, cardLngSchema]);
|
||||
// Re-typed on the way out: server and client compile without strictNullChecks, where an inferred tuple
|
||||
// makes every item optional and no longer fits a `[number, number]`.
|
||||
export const cardPointSchema = z.tuple([cardLatSchema, cardLngSchema]).transform(([lat, lng]): CardPoint => [lat, lng]);
|
||||
|
||||
export const cardDateSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
||||
export const cardClockSchema = z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
|
||||
|
||||
@@ -38,12 +38,10 @@ const sacStep = z.number().int().min(1).max(6);
|
||||
|
||||
/** A point of the line, `[lat, lng, height]` at five decimals; every height is null when one is missing. */
|
||||
export type TourRoutePoint = [number, number, number | null];
|
||||
// Typed by hand like cardPointSchema: an inferred tuple reads every item as optional where strictNullChecks is off.
|
||||
export const tourRoutePointSchema: z.ZodType<TourRoutePoint> = z.tuple([
|
||||
cardLatSchema,
|
||||
cardLngSchema,
|
||||
height.nullable(),
|
||||
]);
|
||||
// Re-typed on the way out like cardPointSchema, for the builds without strictNullChecks.
|
||||
export const tourRoutePointSchema = z
|
||||
.tuple([cardLatSchema, cardLngSchema, height.nullable()])
|
||||
.transform(([lat, lng, metres]): TourRoutePoint => [lat, lng, metres]);
|
||||
|
||||
/** What a stop is beyond its role: a kind of place along a hike, its highest point, a city walk's station. */
|
||||
export const TOUR_ROUTE_STOP_KINDS = ['highest', 'station'] as const;
|
||||
|
||||
Reference in New Issue
Block a user