hooks icon indicating copy to clipboard operation
hooks copied to clipboard

feat(useControllableValue): improve types using key of props

Open u3u opened this issue 1 year ago • 3 comments

[中文版模板 / Chinese template]

🤔 This is a ...

  • [ ] New feature
  • [ ] Bug fix
  • [ ] Site / documentation update
  • [ ] Demo update
  • [x] 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. ⚠️

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

u3u avatar Jul 09 '22 06:07 u3u

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.

:white_check_mark: liuyib
:x: u3u
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jul 09 '22 06:07 CLAassistant

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

brickspert avatar Jul 11 '22 11:07 brickspert

image

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

u3u avatar Jul 16 '22 05:07 u3u