qiniu / formstate-x

Manage state of form with ease.
https://qiniu.github.io/formstate-x
MIT License
33 stars 10 forks source link

Type-safe result of `validate` #60

Closed Luncher closed 2 years ago

Luncher commented 2 years ago

code

    this.configState.validate().then(res => {
      if (res.hasError) {
        this.props.toasterStore.error(res.error)
                                      // ^^^^^^-Type 'undefined' is not assignable to type 'string'.
        return
      }
      //...
    })

Expected behavior

the type of re.error should be inferred correctly