Skip to content

defineFrameworkAdapter

defineFrameworkAdapter<F, TFieldMeta>(adapter): FrameworkAdapter<F, TFieldMeta>

Defined in: packages/core/src/framework.ts:265

Registers a framework adapter, enforcing that all field and cell components are implemented and typed correctly.

This is a zero-runtime identity function — it returns the adapter unchanged. All enforcement happens at the TypeScript level via the F HKT parameter: missing components cause a type error, and each component gets autocomplete for its field-specific props.

F extends ComponentHKT

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

FrameworkAdapterInput<F, TFieldMeta>

The framework adapter implementation.

FrameworkAdapter<F, TFieldMeta>

The same adapter, verified by TypeScript.

import { defineFrameworkAdapter, ComponentHKT } from '@vexcms/core';
import { ComponentType } from 'react';
interface ReactHKT extends ComponentHKT {
component: ComponentType<this['_props']>;
}
export const reactAdapter = defineFrameworkAdapter<ReactHKT>({
name: 'react',
version: '0.1.0',
fields: {
text: MyTextInput, // TS error if missing or wrong props
},
cells: {
text: MyTextCell,
},
});