defineSchema

Implementation-wise defineSchema does nothing but return the object passed to it. However, in terms of typing, the returned value has a synthetic type of a schema like ValidationRuleSchema or FormSchema, TSX and IDE tooling support.

import { FormInstance, defineSchema } from '@vue-formily/formily';

const schema = defineSchema({
  formId: 'login',
  fields: [
    {
      formId: 'email'
    }
  ]
});

type LoginForm = FormInstance<typeof schema>;
Edit this page on GitHub Updated at Fri, Feb 4, 2022