formspree / formspree-js

The fastest way to hook up a React form
https://formspree.io/javascript
MIT License
63 stars 12 forks source link

add FieldErrorCode type to enhance ErrorPayload type safely #9

Closed kotarella1110 closed 2 years ago

kotarella1110 commented 2 years ago

I want to make the errors object type safe by defining the field error code as string literal union type. I got the field error code from the following documents. https://help.formspree.io/hc/en-us/articles/360055613373-The-Formspree-React-library#errorcodes

rohitdatta commented 2 years ago

Thanks for your contribution @kotarella1110 and sorry about the delay! Asking @colevscode to review this

colevscode commented 2 years ago

Thanks! Definitely we should expose the specific error codes. However, we're deprecating the ErrorPayload interface in favor of FormError and FieldError types. I've incorporated your suggestions into a PR on formspree-core here: https://github.com/formspree/formspree-core/pull/6/files. Let me know if this works and we'll merge after some testing.

rohitdatta commented 2 years ago

Closed by https://github.com/formspree/formspree-core/pull/6