Identifying a Date value in an object type
Extenting Type interface
type({}).migrate()
and add it to BaseType
prototype
How do I do it properly?...Morph on failure
const T = type({ id: "string>0", label: "string>0" })
const T = type({ id: "string>0", label: "string>0" })
{ id: string>0, label?: string>=0 }
...Property 'describe' does not exist on type 'instantiateType<inferTupleExpression<...>, {}>'
const create = <T extends number>(code: T) =>
type(["===", code]).describe("abc") as Type<T>;
const create = <T extends number>(code: T) =>
type(["===", code]).describe("abc") as Type<T>;
Piping types no longer works
Post-morph constraints not checked if constraints not met on another property
Is there currently a known issue with arktype + trpc compatibility?
How would you define an object with optional keys, but require at least one of the keys to be filled
const schema = type({ a: type.string.optional(), b: type.string.optional() });
const schema = type({ a: type.string.optional(), b: type.string.optional() });
`scope.validate` for a scope with imports
type.validate
with custom existing scopes is straightforward - just use type.validate<def, scope.t>
However, how do I validate a new scope definition with existing imports/exports?
```ts
import { scope, type } from 'arktype'
...Automatic "full" discriminated union
Is there a recommended way to transform a type union into a discriminated union by adding a tag?
Is there a way to do a case insensitive literal match?
string.lower
to a lower-case literal but that seems complicated for this.Is there a way to perform schema parsing generically?
Use native ts type
type BlockainsName = "bitcoin" | "ethereum" | "solana" | "polygon-pos" | "binance-smart-chain" | "avalanche"
type BlockainsName = "bitcoin" | "ethereum" | "solana" | "polygon-pos" | "binance-smart-chain" | "avalanche"
ParseError: undefined must be a PropertyKey or stringifyNonKey must be passed to options
key
isn't provided in the .map
function, the above error is thrown.
Not working code:
```ts...Dynamic type based on another value
Why does an optional property add a " | undefined" instead of just being an optional property?
| undefined
? I encountered something similar with zod which had the result that my zod-type and database generated type did not match although they should.
Dummy example:
```ts
const schema = type({...Generic with Narrow/Morph
Extracting defaults at runtime
Ark attest cannot find module error
@ark/attest
installed in the workspace root and running pnpx run attest trace .
, I get the following output:
```...