Skip to content
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

Optimize ValueOf #67

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Optimize ValueOf #67

merged 1 commit into from
Feb 15, 2022

Conversation

nighca
Copy link
Collaborator

@nighca nighca commented Feb 15, 2022

So that ValueOf supports any state (other than FieldState & FormState) which correctly implemented Validatable.

For code:

const fooState: Validatable<string> = ...

const formState = new FormState({
  foo: fooState
})

typeof fooState.value.foo // expected to be `string`

Without this PR, typeof fooState.value.foo will be derived as never.

With this PR, it will be derived as string as expected

@nighca nighca force-pushed the type-optimization branch 2 times, most recently from c7a0d19 to bd580e2 Compare February 15, 2022 06:07
Copy link
Collaborator

@lzfee0227 lzfee0227 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nighca nighca merged commit 4f99901 into qiniu:master Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants