Im trying to to use the new Temporal date api in javascript and while trying to write a type using arktype library that takes in a string and morphs it into a Temporal zoned datetime.
Example:
import { Temporal } from '@js-temporal/polyfill';
import { type } from 'arktype';
const dateSchema = type("string").pipe((str: string) => Temporal.ZonedDateTime.from(str));
type DateParse = typeof dateSchema.infer;
const dateParse: DateParse = Temporal.Now.zonedDateTimeISO().toString();
Error:
Type 'string' is not assignable to type { readonly era: string | undefined; ...
The expected result is that the the dateSchema type would be string but it would morph it into a Temporal date.