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

fix: 解决option含有其他key的类型异常问题 #351

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/select/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface SelectOption {
label: string | number;
disabled?: boolean;
__cache?: boolean;
[key: string]: any;
}

export interface OptionChildren extends ToRefs<OptionProps> {

Choose a reason for hiding this comment

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

这是一个给代码进行审查的补丁。根据给出的补丁,我没有找到明显的错误风险。以下是一些建议改进:

  1. 对于SelectOption接口,使用更具体的类型而不是[key: string]: any,以提高代码的类型安全性。只有在确实需要任意类型附加属性时才使用该语法。

  2. 为接口和类型使用一致的命名约定,例如使用驼峰命名法或下划线命名法。

  3. 检查如果disabled字段应该是可选的,或者应该有默认值。

  4. 确保代码中的缩进和代码风格一致。

  5. 如果可能的话,可以添加注释来解释关键部分的功能和用途,以提高代码的可读性。

希望以上建议对您有所帮助!如果你还有其他问题,请随时问我。

Expand Down