Function: validateViewProps()
Documentation / @xmachines/play-xstate / validateViewProps
Implementation — shared by both overloads
Call Signature
function validateViewProps<TCatalog>(componentName, props, catalog): ValidationResult;Defined in: packages/play-xstate/src/catalog/validate-props.ts:35
Validate view props against Zod schema — generic overload for typed catalogs
When called with a typed catalog, componentName is constrained to keyof TCatalog.
Malformed catalog entries or unknown component names produce compile-time errors
rather than runtime failures.
Type Parameters
| Type Parameter | Description |
|---|---|
TCatalog extends Catalog | Catalog type (must extend Catalog) |
Parameters
| Parameter | Type | Description |
|---|---|---|
componentName | keyof TCatalog & string | Component name constrained to string keys of TCatalog |
props | unknown | Props to validate |
catalog | TCatalog | Typed component catalog |
Returns
Zod parse result
Call Signature
function validateViewProps(componentName, props, catalog): ValidationResult;Defined in: packages/play-xstate/src/catalog/validate-props.ts:64
Validate view props against Zod schema — base overload for untyped catalogs
Per CONTEXT.md:
- “Prop validation: At state entry”
- “currentView derivation: Merge meta.view with relevant context data”
Per RESEARCH.md Pattern 4: Use safeParse() for validation
Parameters
| Parameter | Type | Description |
|---|---|---|
componentName | string | Component name from catalog |
props | unknown | Props to validate |
catalog | Catalog | Component catalog with schemas |
Returns
Zod parse result
Example
const props = { userId: "123", stats: { logins: 5 } };const result = validateViewProps("Dashboard", props, catalog);if (!result.success) { console.error(result.error);}