-
-
Notifications
You must be signed in to change notification settings - Fork 460
fix: add undefined
to optional className
properties (fixes #1143)
#1144
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
## Walkthrough
此次更改显式地在 `BaseSelectProps` 接口和 `BaseOptionType` 接口中将 `className` 和 `popupClassName` 两个可选字符串属性的类型声明从隐式的可选(`string` 或未声明)改为显式包含 `undefined`(`string | undefined`)。这些修改仅调整了类型注解的明确性,不影响运行时行为或逻辑。
## Changes
| 文件 | 更改说明 |
|------------------------------|-------------------------------------------------------------------------------------------|
| `src/BaseSelect/index.tsx` 和 `src/Select.tsx` | 在接口 `BaseSelectProps` 和 `BaseOptionType` 中,将 `className` 和 `popupClassName` 属性的类型由隐式可选的 `string` 改为显式包含 `undefined` 的 `string | undefined`。 |
## Possibly related PRs
- **react-component/select#1133**: 此 PR 同样涉及对 `BaseSelectProps` 接口的更新,直接修改了属性声明,与本次改动存在代码层面的联系。
## Suggested reviewers
- zombieJ
## Poem
> 我是小兔跳跃忙,
> 代码更新乐无疆,
> 类型声明更明确,
> 细节变化藏光芒,
> 小改动也辉煌,
> 跟我一起欢歌唱! 🐇 Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/Select.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/BaseSelect/index.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
undefined
to optional className
properties (fixes #1143)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1144 +/- ##
=======================================
Coverage 98.26% 98.26%
=======================================
Files 39 39
Lines 1500 1500
Branches 453 425 -28
=======================================
Hits 1474 1474
Misses 26 26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@zombieJ 你好,打扰了,方便的时候能否帮忙看一下这个PR的改动?这些更改是参考了https://www.github.com/DefinitelyTyped/DefinitelyTyped/pull/54352 这个PR做的。理论上我们可以针对所有的可选属性加入显式的 |
With a reference to https://www.github.com/DefinitelyTyped/DefinitelyTyped/pull/54352, this PR addresses a TypeScript error that occurs when using rc-select with CSS Modules in a Vite project with
exactOptionalPropertyTypes: true
enabled.Summary by CodeRabbit
BaseSelectProps
接口和BaseOptionType
接口中将className
和popupClassName
两个可选字符串属性的类型声明从隐式的可选(string
或未声明)改为显式包含undefined
(string | undefined
)。这些修改仅调整了类型注解的明确性,不影响运行时行为或逻辑。