action-return-type.ts — astro Source File
Architecture documentation for action-return-type.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 611f69eb_dd99_386d_8a18_55f06a4b8424["action-return-type.ts"] e6a2dc9f_6948_1e06_e648_bf517c8e5501["../../../dist/actions/runtime/server.js"] 611f69eb_dd99_386d_8a18_55f06a4b8424 --> e6a2dc9f_6948_1e06_e648_bf517c8e5501 b452f73b_f98f_aa44_9234_6b4bf8f5bf18["../../dist/actions/runtime/types.js"] 611f69eb_dd99_386d_8a18_55f06a4b8424 --> b452f73b_f98f_aa44_9234_6b4bf8f5bf18 c6e6d952_1368_2c1c_2f3a_ad92a305600b["../../dist/zod.js"] 611f69eb_dd99_386d_8a18_55f06a4b8424 --> c6e6d952_1368_2c1c_2f3a_ad92a305600b 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 611f69eb_dd99_386d_8a18_55f06a4b8424 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 687364c6_0b6b_44e7_012a_aa483da82c1b["expect-type"] 611f69eb_dd99_386d_8a18_55f06a4b8424 --> 687364c6_0b6b_44e7_012a_aa483da82c1b style 611f69eb_dd99_386d_8a18_55f06a4b8424 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, it } from 'node:test';
import { expectTypeOf } from 'expect-type';
import { defineAction } from '../../dist/actions/runtime/server.js';
import type { ActionReturnType, SafeResult } from '../../dist/actions/runtime/types.js';
import { z } from '../../dist/zod.js';
describe('ActionReturnType', () => {
it('Infers action return type', async () => {
const _action = defineAction({
input: z.object({
name: z.string(),
}),
handler: async ({ name }) => {
return { name };
},
});
expectTypeOf<ActionReturnType<typeof _action>>().toEqualTypeOf<
SafeResult<any, { name: string }>
>();
expectTypeOf<ActionReturnType<typeof _action.orThrow>>().toEqualTypeOf<{ name: string }>();
});
it('Infers action return type when input is omitted', async () => {
const _action = defineAction({
handler: async () => {
return { name: 'Ben' };
},
});
expectTypeOf<ActionReturnType<typeof _action>>().toEqualTypeOf<
SafeResult<any, { name: string }>
>();
expectTypeOf<ActionReturnType<typeof _action.orThrow>>().toEqualTypeOf<{ name: string }>();
});
});
Domain
Dependencies
- ../../../dist/actions/runtime/server.js
- ../../dist/actions/runtime/types.js
- ../../dist/zod.js
- expect-type
- node:test
Source
Frequently Asked Questions
What does action-return-type.ts do?
action-return-type.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain.
What does action-return-type.ts depend on?
action-return-type.ts imports 5 module(s): ../../../dist/actions/runtime/server.js, ../../dist/actions/runtime/types.js, ../../dist/zod.js, expect-type, node:test.
Where is action-return-type.ts in the architecture?
action-return-type.ts is located at packages/astro/test/types/action-return-type.ts (domain: IntegrationAdapters, directory: packages/astro/test/types).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free