11import { useState , useEffect } from "react" ;
2- import { useForm , useWatch } from "react-hook-form" ;
2+ import { FieldValues , useForm , useWatch } from "react-hook-form" ;
33import {
44 Button ,
55 Form ,
@@ -18,10 +18,8 @@ import { UnregisterSnapModal } from "./UnregisterSnapModal";
1818
1919import { getSettingsData , getSettingsFormData } from "../../utils" ;
2020
21- import type { SettingsData } from "../../types" ;
22-
2321type Props = {
24- settings : SettingsData ;
22+ settings : FieldValues ;
2523} ;
2624
2725function PublisherSettingsForm ( { settings } : Props ) {
@@ -68,7 +66,7 @@ function PublisherSettingsForm({ settings }: Props) {
6866 name : "blacklist_country_keys" ,
6967 } ) ;
7068
71- const onSubmit = ( data : SettingsData ) => {
69+ const onSubmit = ( data : FieldValues ) => {
7270 if ( getValues ( "update_metadata_on_release" ) && dirtyFields . visibility ) {
7371 setShowMetadataWarningModal ( true ) ;
7472 setFormData ( data ) ;
@@ -77,7 +75,7 @@ function PublisherSettingsForm({ settings }: Props) {
7775 }
7876 } ;
7977
80- const submitForm = async ( data : SettingsData ) => {
78+ const submitForm = async ( data : FieldValues ) => {
8179 setIsSaving ( true ) ;
8280 setHasSaved ( false ) ;
8381 setSavedError ( false ) ;
@@ -334,13 +332,9 @@ function PublisherSettingsForm({ settings }: Props) {
334332 data = { countries }
335333 field = "whitelist_country_keys"
336334 currentValues = { settingsData ?. whitelist_countries }
337- // @ts -expect-error Conflict between React Query and React Hook Form
338335 register = { register }
339- // @ts -expect-error Conflict between React Query and React Hook Form
340336 setValue = { setValue }
341- // @ts -expect-error Conflict between React Query and React Hook Form
342337 getValues = { getValues }
343- // @ts -expect-error Conflict between React Query and React Hook Form
344338 control = { control }
345339 disabled = { getValues ( "country_keys_status" ) === "exclude" }
346340 />
@@ -364,13 +358,9 @@ function PublisherSettingsForm({ settings }: Props) {
364358 data = { countries }
365359 field = "blacklist_country_keys"
366360 currentValues = { settingsData ?. blacklist_countries }
367- // @ts -expect-error Conflict between React Query and React Hook Form
368361 register = { register }
369- // @ts -expect-error Conflict between React Query and React Hook Form
370362 setValue = { setValue }
371- // @ts -expect-error Conflict between React Query and React Hook Form
372363 getValues = { getValues }
373- // @ts -expect-error Conflict between React Query and React Hook Form
374364 control = { control }
375365 disabled = { getValues ( "country_keys_status" ) === "include" }
376366 />
@@ -537,7 +527,6 @@ function PublisherSettingsForm({ settings }: Props) {
537527 { showMetadataWarningModal ? (
538528 < UpdateMetadataModal
539529 setShowMetadataWarningModal = { setShowMetadataWarningModal }
540- // @ts -expect-error Conflict between React Query and React Hook Form
541530 submitForm = { submitForm }
542531 formData = { formData }
543532 />
0 commit comments