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

Commit a39d7da

Browse files
diego3gjpedroschmitz
authored andcommitted
fix: Change data record value type to any
1 parent 8ff632a commit a39d7da

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

packages/core/__tests__/utils/RenderTest.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { render as rtlRender } from '@testing-library/react'
44

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

7-
export function render(
8-
children: ReactNode,
9-
props: Record<string, unknown> = {}
10-
) {
7+
export function render(children: ReactNode, props: Record<string, any> = {}) {
118
const mockFunction = jest.fn()
129
return rtlRender(
1310
<Form data-testid="form" onSubmit={mockFunction} {...props}>

packages/core/lib/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface UnformErrors {
2929
}
3030

3131
export interface UnformContext {
32-
initialData: Record<string, unknown>
32+
initialData: Record<string, any>
3333
errors: UnformErrors
3434
scopePath: string
3535
registerField<T>(field: UnformField<T>): void
@@ -51,25 +51,25 @@ export interface FormHandles {
5151
getFieldError(fieldName: string): string | undefined
5252
setFieldError(fieldName: string, error: string): void
5353
clearField(fieldName: string): void
54-
getData(): Record<string, unknown>
54+
getData(): Record<string, any>
5555
getFieldRef(fieldName: string): any
56-
setData(data: Record<string, unknown>): void
56+
setData(data: Record<string, any>): void
5757
getErrors(): UnformErrors
5858
setErrors(errors: Record<string, string>): void
59-
reset(data?: Record<string, unknown>): void
59+
reset(data?: Record<string, any>): void
6060
submitForm(): void
6161
}
6262

6363
export interface FormHelpers {
64-
reset: (data?: Record<string, unknown>) => void
64+
reset: (data?: Record<string, any>) => void
6565
}
6666

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

7171
export interface FormProps extends Omit<HTMLFormProps, 'onSubmit'> {
72-
initialData?: Record<string, unknown>
72+
initialData?: Record<string, any>
7373
children: ReactNode
7474
onSubmit: SubmitHandler
7575
}

packages/mobile/__tests__/Form.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Input from './components/Input'
1414
interface UnformProps {
1515
onSubmit(): void
1616
children?: ReactNode
17-
initialData?: Record<string, unknown>
17+
initialData?: Record<string, any>
1818
}
1919

2020
const UnformRoot: ForwardRefRenderFunction<FormHandles, UnformProps> = (

packages/mobile/lib/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { View, ViewProps } from 'react-native'
44
import { FormProvider, FormHandles, SubmitHandler } from '@unform/core'
55

66
export interface FormProps extends ViewProps {
7-
initialData?: Record<string, unknown>
7+
initialData?: Record<string, any>
88
children: ReactNode
99
onSubmit: SubmitHandler
1010
}

0 commit comments

Comments
 (0)