Formik: TypeError: field.resolve is not a function

Created on 24 Oct 2018  路  3Comments  路  Source: formium/formik

馃悰 Bug report

Current Behavior

it was working fine yesterday, but today it stopped working o/

it is throwing this error;

Uncaught (in promise) TypeError: field.resolve is not a function
    at eval (object.js?0109:159)
    at eval (transform.js?50ca:60)
    at arrayEach (_arrayEach.js?8057:15)
    at transform (transform.js?50ca:59)
    at ObjectSchema._cast (object.js?0109:147)
    at ObjectSchema._validate (mixed.js?b64f:261)
    at ObjectSchema._validate (object.js?0109:187)
    at ObjectSchema.validate (mixed.js?b64f:303)
    at validateYupSchema (formik.esm.js?2983:519)
    at eval (formik.esm.js?2983:175)

Expected behavior

it should not thrown an error

Reproducible example

Your environment

| Software | Version(s) |
| ---------------- | ---------- |
| Formik | 1.0.3 and 1.3.1 (tested on both)
| React | 16.4.1
| TypeScript | using pure js
| Browser | chrome
| npm/Yarn | yarn
| Operating System | mac os

Most helpful comment

I spent a few minutes trying to solve this issue just to find out that I forgot the method call:

wrong:

{
  first_name: Yup.string().required
}

correct:

{
  first_name: Yup.string().required()
}

All 3 comments

never mind, bug on our validationSchema

tks

I had this same problem while using nested forms ... I later realized that with nested forms every level on nesting should be wrapped in yup.object ... I did that and it worked for me ... hope this helps :)

I spent a few minutes trying to solve this issue just to find out that I forgot the method call:

wrong:

{
  first_name: Yup.string().required
}

correct:

{
  first_name: Yup.string().required()
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmonty picture pmonty  路  3Comments

jeffbski picture jeffbski  路  3Comments

outaTiME picture outaTiME  路  3Comments

jordantrainor picture jordantrainor  路  3Comments

PeerHartmann picture PeerHartmann  路  3Comments