Home / File/ types.ts — astro Source File

types.ts — astro Source File

Architecture documentation for types.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  bdc6ff27_167d_e3f3_67b4_3308b4d8fd29["types.ts"]
  baa53824_73a3_1e03_2043_4d0c058ecca5["../types/public/index.js"]
  bdc6ff27_167d_e3f3_67b4_3308b4d8fd29 --> baa53824_73a3_1e03_2043_4d0c058ecca5
  b0bf0fd2_1ce5_745d_58fc_02deee5192bf["../actions/runtime/client.js"]
  bdc6ff27_167d_e3f3_67b4_3308b4d8fd29 --> b0bf0fd2_1ce5_745d_58fc_02deee5192bf
  a2586aae_ce09_613d_4444_659268b61a89["core"]
  bdc6ff27_167d_e3f3_67b4_3308b4d8fd29 --> a2586aae_ce09_613d_4444_659268b61a89
  style bdc6ff27_167d_e3f3_67b4_3308b4d8fd29 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type * as z from 'zod/v4/core';
import type { APIContext } from '../../types/public/index.js';
import type { ActionError, codeToStatusMap } from './client.js';

export type ActionErrorCode = keyof typeof codeToStatusMap;

export type ActionAccept = 'form' | 'json';

export type ActionHandler<TInputSchema, TOutput> = TInputSchema extends z.$ZodType
	? (input: z.infer<TInputSchema>, context: ActionAPIContext) => MaybePromise<TOutput>
	: (input: any, context: ActionAPIContext) => MaybePromise<TOutput>;

export type ActionReturnType<T extends ActionHandler<any, any>> = Awaited<ReturnType<T>>;

type InferKey = '__internalInfer';

/**
 * Infers the type of an action's input based on its Zod schema
 *
 * @see https://docs.astro.build/en/reference/modules/astro-actions/#actioninputschema
 */
export type ActionInputSchema<T extends ActionClient<any, any, any>> = T extends {
	[key in InferKey]: any;
}
	? T[InferKey]
	: never;

export type ActionClient<
	TOutput,
	TAccept extends ActionAccept | undefined,
	TInputSchema extends z.$ZodType | undefined,
> = TInputSchema extends z.$ZodType
	? ((
			input: TAccept extends 'form' ? FormData : z.input<TInputSchema>,
		) => Promise<
			SafeResult<
				z.input<TInputSchema> extends ErrorInferenceObject
					? z.input<TInputSchema>
					: ErrorInferenceObject,
				Awaited<TOutput>
			>
		>) & {
			queryString: string;
			orThrow: (
				input: TAccept extends 'form' ? FormData : z.input<TInputSchema>,
			) => Promise<Awaited<TOutput>>;
		} & {
			[key in InferKey]: TInputSchema;
		}
	: ((input?: any) => Promise<SafeResult<never, Awaited<TOutput>>>) & {
			orThrow: (input?: any) => Promise<Awaited<TOutput>>;
		};

export type SafeResult<TInput extends ErrorInferenceObject, TOutput> =
	| {
			data: TOutput;
			error: undefined;
	  }
	| {
			data: undefined;
// ... (61 more lines)

Domain

Subdomains

Functions

Dependencies

  • ../actions/runtime/client.js
  • ../types/public/index.js
  • core

Frequently Asked Questions

What does types.ts do?
types.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in types.ts?
types.ts defines 1 function(s): input.
What does types.ts depend on?
types.ts imports 3 module(s): ../actions/runtime/client.js, ../types/public/index.js, core.
Where is types.ts in the architecture?
types.ts is located at packages/astro/src/actions/runtime/types.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/actions/runtime).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free