fix(types): improve Schema type for useForm

This commit is contained in:
Divlo
2022-09-21 09:33:09 +02:00
parent d213893d5d
commit fcc2b2ea77
7 changed files with 4083 additions and 5221 deletions

View File

@ -1,7 +1,8 @@
import React from 'react'
import { render, cleanup, fireEvent } from '@testing-library/react'
import { Form, HandleForm } from '..'
import type { HandleForm } from '..'
import { Form } from '..'
afterEach(cleanup)

View File

@ -1,14 +1,18 @@
import { useMemo, useState } from 'react'
import { SchemaOptions, Static, TObject, Type } from '@sinclair/typebox'
import type { Static, TObject } from '@sinclair/typebox'
import { Type } from '@sinclair/typebox'
import type { ErrorObject } from 'ajv'
import type { HandleForm } from '../components/Form'
import { FetchState, useFetchState } from './useFetchState'
import type { FetchState } from './useFetchState'
import { useFetchState } from './useFetchState'
import { ajv } from '../utils/ajv'
import { handleCheckboxBoolean } from '../utils/handleCheckboxBoolean'
import { handleOptionalEmptyStringToNull } from '../utils/handleOptionalEmptyStringToNull'
export type Schema = SchemaOptions
export interface Schema {
[property: string]: any
}
export type Error = ErrorObject