From e69cfea13fc2d94654a3cc0ceb43f093bbd3f7c0 Mon Sep 17 00:00:00 2001 From: orangain Date: Fri, 4 Oct 2019 07:27:05 +0900 Subject: [PATCH] fix type of event argument in onSubmit * Fix type of event argument in onSubmit * Don't use alert in test code --- types/react-material-ui-form-validator/index.d.ts | 2 +- .../react-material-ui-form-validator-tests.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/react-material-ui-form-validator/index.d.ts b/types/react-material-ui-form-validator/index.d.ts index c54c1b9095..b8ad8ef550 100644 --- a/types/react-material-ui-form-validator/index.d.ts +++ b/types/react-material-ui-form-validator/index.d.ts @@ -10,7 +10,7 @@ import { TextFieldProps } from "material-ui"; export interface ValidatorFormProps { className?: string; - onSubmit: (event: React.FormEventHandler) => void; + onSubmit: (event: React.FormEvent) => void; instantValidate?: boolean; onError?: (errors: any[]) => void; debounceTime?: number; diff --git a/types/react-material-ui-form-validator/react-material-ui-form-validator-tests.tsx b/types/react-material-ui-form-validator/react-material-ui-form-validator-tests.tsx index bf4b303502..df6dad47d7 100644 --- a/types/react-material-ui-form-validator/react-material-ui-form-validator-tests.tsx +++ b/types/react-material-ui-form-validator/react-material-ui-form-validator-tests.tsx @@ -6,7 +6,9 @@ import { } from 'react-material-ui-form-validator'; class Test extends React.Component { - onSubmitted = (event: React.FormEventHandler) => {}; + onSubmitted = (event: React.FormEvent) => { + event.preventDefault(); // Actually preventDefault() is called by ValidatorForm + } onError = (errors: any[]) => {}; onValidate = (isValid: boolean) => {};