Type Declarations
This section only covers the public types defined by @silver-formily/react itself, and how it consumes types from other packages on the React side.
If a type already belongs to @silver-formily/core, @silver-formily/path, @silver-formily/validator or @silver-formily/json-schema, the original declaration is not duplicated here; instead, a stable entry point and a link are provided.
When to import from @silver-formily/react
- The type directly involves React components, component mappings, scope objects or recursive rendering configuration.
- What you are describing is the props of a React component, not the Core field model itself.
- You need to stay consistent with React components such as
SchemaField,RecursionFieldandExpressionScope.
Type Map
| Category | Recommended Reference | Description |
|---|---|---|
| Field component props | Field | Explains the React-side wrappers IFieldProps, IVoidFieldProps and RenderPropsChildren. |
| Path bridge | Path | The React package only consumes FormPathPattern; it does not redefine the path protocol. |
| Validator bridge | Validator | The field validator directly reuses FieldValidator from @silver-formily/core. |
| Schema protocol | Schema | Schema, ISchema, SchemaKey and the x-* protocols all belong to the json-schema package. |
React-specific Types
Fields and Contexts
JSXComponent: the React-side component type constraint,keyof React.JSX.IntrinsicElementsor a component constructor.IProviderProps: the props ofFormProvider, with requiredformand optionalchildren.IFormSpyProps: the props ofFormConsumer, wherechildrenis(form: Form) => React.ReactNode.RenderPropsChildren<Payload>: thechildrenof field components, either a render function(field, form) => ReactNodeor a plainReactNode.DecoratorContent: decorator content (forx-decorator-content), either plain content or a named prop map.IFieldProps<D, C>: field component props; extends Core'sIFieldFactoryPropswith the React-semanticchildren,decoratorContent,decoratorandcomponent.IVoidFieldProps<D, C>: theVoidFieldcomponent props, sourced similarly toIFieldProps.IExpressionScopeProps/IRecordScopeProps/IRecordsScopeProps: the props ofExpressionScope,RecordScopeandRecordsScope.
Component Mapping and State Mapping
IComponentMapper<T>: converts one component into another, commonly used in adapters likeconnect.IStateMapper<Props>: maps field state to component props, either with an object mapping or a function mapping.
Schema Rendering
SchemaReactComponents: the component registry ofSchemaField, whose keys are the component names referenced in the schema.ISchemaFieldReactFactoryOptions: the React configuration entry ofcreateSchemaField, mainlycomponentsandscope.ISchemaFieldProps: theSchemaFieldcomponent props.ISchemaMapper/ISchemaFilter: map or filter schema nodes during recursive rendering.IRecursionFieldProps: theRecursionFieldcomponent props, wherebasePathcomes from the path system.ISchemaMarkupFieldProps/ISchemaTypeFieldProps: the Markup Schema field protocol, preserving React component mapping capabilities.
Helper Generics
KeyOfReactComponent<T>: excludes static keys likecontextTypesanddisplayNamefrom a component object.ReactComponentPath<T>: extracts the usable string keys from a component mapping object.ReactComponentPropsByPathValue<T, P>: infers a component's props from its key.Path<T>/PathValue<T, P>: generics for deep object paths and value lookup.ReactChild: deprecated compatibility aliasReact.ReactElement | string | number; useReact.ReactNodein new code.
Types Not Covered Here
- Field model, form model,
Field,GeneralField,Form: see the Formily Core documentation and Form. - Path system,
FormPathPattern: see the Path documentation. - Validation rules,
Validator,FieldValidator: see the Validator documentation. - Schema protocol,
Schema,ISchema,SchemaKey: see the JSON Schema documentation.
Import Recommendations
import type {
IFieldProps,
IRecursionFieldProps,
ISchemaFieldProps,
SchemaReactComponents,
} from '@silver-formily/react'If you just want to reuse the underlying models, import them directly from the source packages, which makes the type origins clearer:
import type { Form, GeneralField } from '@silver-formily/core'
import type { ISchema } from '@silver-formily/json-schema'
import type { Pattern } from '@silver-formily/path'
import type { Validator } from '@silver-formily/validator'Additional public types
ConnectedComponent<T>: the return type ofconnect, preserving ref types and custom statics.ISchemaFieldOptionContext:{ components: SchemaReactComponents }; this compatibility type is exported, butSchemaOptionsContextactually usesISchemaFieldReactFactoryOptions.ObjectKey:string | number | boolean | symbol.
Path<T> is a TypeScript utility, not the runtime Path class from @silver-formily/path. The React entry does not re-export JSON Schema APIs, reactive-react hooks, or IObserverProps / IObserverOptions; only observer and Observer are re-exported from reactive-react. Internal ReactiveField, useAttach, and the portal render helper are not public entry exports.