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: function type judgment #2457

Closed
wants to merge 1 commit into from

Conversation

JinYuSha0
Copy link

Related Issues or Discussions

optimize:
microsoft/TypeScript#37663 (comment)

Summary

Although this problem may be an official typescript problem, this way of writing should be better than using as force conversion.

Check List

  • [ √] yarn run prettier for formatting code and docs

Copy link

vercel bot commented Apr 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 7:52am

Copy link

codesandbox-ci bot commented Apr 3, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

typeof partial === 'function'
? (partial as (state: TState) => TState)(state)
: partial
const nextState = isFunction(partial) ? partial(state) : partial
Copy link
Member

Choose a reason for hiding this comment

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

It's our intention to avoid this. We hope TS fixes it in the future.

@dai-shi
Copy link
Member

dai-shi commented Apr 3, 2024

Thanks for the suggestion, but it's as intended.

@dai-shi dai-shi closed this Apr 3, 2024
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