-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Types of property 'value' are incompatible. Type 'string' is not assignable to type 'E164Number' #28
Comments
+1 |
My mistake was that my editor auto imported Form component from react-hook-form when it should have been imported from @/components/ui/form. 👀 |
still am getting same error |
Added some basic type conversion and it worked for me.
|
Did you manage to get it sorted? |
this is the phone-input component ready to use with react-hook-form
so you can use it like this easly inside your component
make your sure to include the phone validation
|
onChange={(value) =>
onChange?.(
value ||
Object.assign<"", { __tag: "E164Number" }>("", {
__tag: "E164Number",
})
)
} |
I encountered the same type of error. I believe it's due to the fact that the react-phone-number-input package utilizes the latest version of libphonenumber-js, which has a different type value for E164Number. To address this issue temporarily, I included libphonenumber-js as a dependency and specified its version as 1.10.61 to revert to the previous type value for E164Number. |
@jjppsia yeah this version is supposed to solve the issue I saw the channel log on gitlab |
I tried this but react-phone-number-input still uses version 1.11.1
|
oh i |
@jjppsia thanks for the quick response overrides doesn't work with yarn so I used resolutions and everything now works
|
does not work for me |
@ezevic |
I did a clean install of the project's dependencies. I also checked the libphonenumber-js package version and it is 1.10.61 |
u checked it in your package json or in the package json of |
I checked in the package json of react-phone-number-input |
First this is awesome i love it.
But when i try to use the example code The input form is throwing this error
Type '{ onChange: (...event: any[]) => void; onBlur: Noop; value: string; disabled?: boolean | undefined; name: "phone"; ref: RefCallBack; placeholder: string; }' is not assignable to type 'Omit<Props<PhoneInputWithCountrySelectType>, "onChange">'.
Types of property 'value' are incompatible.
Type 'string' is not assignable to type 'E164Number'.ts(2322)
(alias) const PhoneInput: React.ForwardRefExoticComponent
import PhoneInput
The text was updated successfully, but these errors were encountered: