@sugardarius/anzen

Credits

Acknowledgments for projects that influenced Anzen’s types and APIs.

StandardSchemaDictionary

Thanks to @t3-oss/env-core for the implementation path behind StandardSchemaDictionary — the dictionary-of-Standard Schema fields pattern Anzen uses for things like segments, search params, and form data.

standard-schema-dictionary.ts
export type StandardSchemaDictionary<
  Input = Record<string, unknown>,
  Output extends Record<keyof Input, unknown> = Input,
> = {
  [K in keyof Input]-?: StandardSchemaV1<Input[K], Output[K]>
}

export namespace StandardSchemaDictionary {
  export type InferInput<T extends StandardSchemaDictionary> = {
    [K in keyof T]: StandardSchemaV1.InferInput<T[K]>
  }
  export type InferOutput<T extends StandardSchemaDictionary> = {
    [K in keyof T]: StandardSchemaV1.InferOutput<T[K]>
  }
}

Their prior work in packages/core/src/standard.ts informed how that type is modeled in the library. 🙏🏻

Last updated on

On this page