is-input-error.ts — astro Source File
Architecture documentation for is-input-error.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8080b251_5c3a_dd4d_4218_0c89b8d23cf0["is-input-error.ts"] 2c2a0d3c_e029_a63a_2c05_21081b187598["../../dist/actions/runtime/client.js"] 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 --> 2c2a0d3c_e029_a63a_2c05_21081b187598 e6a2dc9f_6948_1e06_e648_bf517c8e5501["../../../dist/actions/runtime/server.js"] 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 --> e6a2dc9f_6948_1e06_e648_bf517c8e5501 c6e6d952_1368_2c1c_2f3a_ad92a305600b["../../dist/zod.js"] 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 --> c6e6d952_1368_2c1c_2f3a_ad92a305600b 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 687364c6_0b6b_44e7_012a_aa483da82c1b["expect-type"] 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 --> 687364c6_0b6b_44e7_012a_aa483da82c1b style 8080b251_5c3a_dd4d_4218_0c89b8d23cf0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, it } from 'node:test';
import { expectTypeOf } from 'expect-type';
import { isInputError } from '../../dist/actions/runtime/client.js';
import { defineAction } from '../../dist/actions/runtime/server.js';
import { z } from '../../dist/zod.js';
const exampleAction = defineAction({
input: z.object({
name: z.string(),
}),
handler: () => {},
});
const result = await exampleAction({ name: 'Alice' });
describe('isInputError', () => {
it('isInputError narrows unknown error types', async () => {
try {
await exampleAction({ name: 'Alice' });
} catch (e) {
if (isInputError(e)) {
expectTypeOf(e.fields).toEqualTypeOf<Record<string, string[] | undefined>>();
}
}
});
it('`isInputError` preserves `fields` object type for ActionError objects', async () => {
if (isInputError(result.error)) {
expectTypeOf(result.error.fields).toEqualTypeOf<{ name?: string[] }>();
}
});
});
Domain
Subdomains
Functions
Dependencies
- ../../../dist/actions/runtime/server.js
- ../../dist/actions/runtime/client.js
- ../../dist/zod.js
- expect-type
- node:test
Source
Frequently Asked Questions
What does is-input-error.ts do?
is-input-error.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in is-input-error.ts?
is-input-error.ts defines 1 function(s): exampleAction.handler.
What does is-input-error.ts depend on?
is-input-error.ts imports 5 module(s): ../../../dist/actions/runtime/server.js, ../../dist/actions/runtime/client.js, ../../dist/zod.js, expect-type, node:test.
Where is is-input-error.ts in the architecture?
is-input-error.ts is located at packages/astro/test/types/is-input-error.ts (domain: IntegrationAdapters, subdomain: SsrAdapters, 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