Types
This document outlines the key TypeScript interfaces and types used in the Weaverse Hydrogen package. Understanding these types is essential for building type-safe components and integrating with the Weaverse system.Component Types
HydrogenComponent
Defines a component module that can be registered with Weaverse.HydrogenComponentProps
Base props for any Weaverse Hydrogen component.HydrogenComponentSchema (Legacy)
⚠️ Deprecated: Use the createSchema()
function instead of manually defining schema types. See the Component Schema section above for the modern approach.
For legacy reference, the manual schema interface was:
createSchema()
:
HydrogenComponentData
Data structure for a component instance.Inspector Types
Types used for defining the settings UI in Weaverse Studio.Note: These types are still called “Inspector” types for historical reasons, but they are used to define thesettings
property in component schemas. Theinspector
property itself has been deprecated in favor ofsettings
.
InspectorGroup
BasicInput
HeadingInput
Loader Types
Types related to data loading and server integration.ComponentLoaderArgs
RouteLoaderArgs
WeaverseLoaderData
Theme Types
HydrogenThemeSettings
HydrogenThemeSchema
Note: Theinspector
property has been deprecated in favor ofsettings
. Whileinspector
is still supported for backward compatibility, new theme schemas should usesettings
.
Miscellaneous Types
PageType
Enumerates supported page types in Shopify Hydrogen.WeaverseI18n
Internationalization configuration.Usage Example
Here’s how you might use these types to define a component:Type Extensions
Weaverse Hydrogen extends several types from Remix Oxygen and Shopify Hydrogen:Related
- WeaverseHydrogenRoot - The main component that uses these types
- WeaverseClient - Client for fetching Weaverse content
Component Schema
The modern way to define component schemas is using thecreateSchema()
function:
createSchema()
function provides:
- Runtime validation using Zod
- Better TypeScript inference
- Consistent validation across all schemas
- Future-proof schema definitions
Schema Properties
When usingcreateSchema()
, you can define the following properties: