Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: Change data record value type to any
Browse files Browse the repository at this point in the history
  • Loading branch information
diego3g committed Feb 2, 2021
1 parent 8ff632a commit 46f9bb4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
5 changes: 1 addition & 4 deletions packages/core/__tests__/utils/RenderTest.tsx
Expand Up @@ -4,10 +4,7 @@ import { render as rtlRender } from '@testing-library/react'

import { Form } from '../../../web/lib'

export function render(
children: ReactNode,
props: Record<string, unknown> = {}
) {
export function render(children: ReactNode, props: Record<string, any> = {}) {
const mockFunction = jest.fn()
return rtlRender(
<Form data-testid="form" onSubmit={mockFunction} {...props}>
Expand Down
12 changes: 6 additions & 6 deletions packages/core/lib/types.ts
Expand Up @@ -29,7 +29,7 @@ export interface UnformErrors {
}

export interface UnformContext {
initialData: Record<string, unknown>
initialData: Record<string, any>
errors: UnformErrors
scopePath: string
registerField<T>(field: UnformField<T>): void
Expand All @@ -51,25 +51,25 @@ export interface FormHandles {
getFieldError(fieldName: string): string | undefined
setFieldError(fieldName: string, error: string): void
clearField(fieldName: string): void
getData(): Record<string, unknown>
getData(): Record<string, any>
getFieldRef(fieldName: string): any
setData(data: Record<string, unknown>): void
setData(data: Record<string, any>): void
getErrors(): UnformErrors
setErrors(errors: Record<string, string>): void
reset(data?: Record<string, unknown>): void
reset(data?: Record<string, any>): void
submitForm(): void
}

export interface FormHelpers {
reset: (data?: Record<string, unknown>) => void
reset: (data?: Record<string, any>) => void
}

export interface SubmitHandler<T = any> {
(data: T, helpers: FormHelpers, event?: FormEvent): void
}

export interface FormProps extends Omit<HTMLFormProps, 'onSubmit'> {
initialData?: Record<string, unknown>
initialData?: Record<string, any>
children: ReactNode
onSubmit: SubmitHandler
}
2 changes: 1 addition & 1 deletion packages/mobile/__tests__/Form.spec.tsx
Expand Up @@ -14,7 +14,7 @@ import Input from './components/Input'
interface UnformProps {
onSubmit(): void
children?: ReactNode
initialData?: Record<string, unknown>
initialData?: Record<string, any>
}

const UnformRoot: ForwardRefRenderFunction<FormHandles, UnformProps> = (
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/lib/Form.tsx
Expand Up @@ -4,7 +4,7 @@ import { View, ViewProps } from 'react-native'
import { FormProvider, FormHandles, SubmitHandler } from '@unform/core'

export interface FormProps extends ViewProps {
initialData?: Record<string, unknown>
initialData?: Record<string, any>
children: ReactNode
onSubmit: SubmitHandler
}
Expand Down

0 comments on commit 46f9bb4

Please sign in to comment.