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

feat(useControllableValue): improve types using key of props #1748

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

u3u
Copy link

@u3u u3u commented Jul 9, 2022

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Restrict the input of defaultValuePropName, valuePropName and trigger to be the key in props

image

📝 Changelog

Language Changelog
🇺🇸 English feat(useControllableValue): improve types using key of props
🇨🇳 Chinese feat(useControllableValue): 使用 props 的 key 改进类型

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@CLAassistant
Copy link

CLAassistant commented Jul 9, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ liuyib
❌ u3u
You have signed the CLA already but the status is still pending? Let us recheck it.

@brickspert
Copy link
Collaborator

我这边测试是没问题的,另外 keyof P 不也是 string 吗?
image

@u3u
Copy link
Author

u3u commented Jul 16, 2022

image

类型推断指定了第一个泛型被中断了 必须手动指定第二个泛型的类型 但是不指定第一个泛型又不能确定 value 的类型 不知道还有没有更好的办法 如果能直接推断出 valuePropName 对应的类型就好了

@liuyib liuyib self-requested a review March 11, 2023 10:06
@liuyib liuyib added this to In progress in ahooks tasks via automation Mar 11, 2023
@liuyib liuyib moved this from In progress to To do in ahooks tasks Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants