Replace "any" type with an explicit type (https://github.com/woocommerce/woocommerce-admin/pull/8262)
* Replace "any" type with an explicit type * Add types in utils and import FormInputProps to store address
This commit is contained in:
parent
83e1addd82
commit
6dc5189fc2
|
@ -14,6 +14,7 @@ import { useSelect } from '@wordpress/data';
|
|||
* Internal dependencies
|
||||
*/
|
||||
import { getAdminSetting } from '~/utils/admin-settings';
|
||||
import { FormInputProps } from '~/utils/types';
|
||||
|
||||
const { countries } = getAdminSetting( 'dataEndpoints', { countries: {} } );
|
||||
const storeAddressFields = [
|
||||
|
@ -322,9 +323,7 @@ export function useGetCountryStateAutofill(
|
|||
}
|
||||
|
||||
type StoreAddressProps = {
|
||||
// Disable reason: The getInputProps type are not provided by the caller and source.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
getInputProps: any;
|
||||
getInputProps: ( key: string ) => FormInputProps;
|
||||
setValue: ( key: string, value: string ) => void;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
export type FormValue = HTMLInputElement[ 'value' ];
|
||||
|
||||
// TODO: move to packages/components/Form when we convert From to TS.
|
||||
export type FormInputProps = {
|
||||
value: FormValue;
|
||||
checked: boolean;
|
||||
selected: FormValue;
|
||||
onChange: ( value: FormValue ) => void;
|
||||
onBlur: () => void;
|
||||
className: string;
|
||||
help: string | null;
|
||||
};
|
Loading…
Reference in New Issue