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: 对于配置config 类型的修复 #890

Merged
merged 6 commits into from
Sep 9, 2024
Merged

Conversation

RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Sep 4, 2024

关联 #839

@RSS1102
Copy link
Collaborator Author

RSS1102 commented Sep 4, 2024

但是 [key: symbol]: any; 会导致之前的版本ts类型不兼容,出现类型错误提示。

当为[key: string]: any;]时:

  1. 如果是当用户不传入自定义的CherryToolbarsCustom的时候识别toolbar的内的每个字段都是string,所以无论传入任何字符串都不会提示类型错误。
  2. 如果用户传入泛型CherryOptions<CustomConfig>时符合正常预期,传入不合规的toolbar会产生错误提示。

当为[key: symbol]: any;]时:

  1. 如果是当用户不传入自定义的CherryToolbarsCustom的时候传入不合规的toolbar会产生错误提示。
  2. 如果用户传入泛型CherryOptions<CustomConfig>时符合正常预期,传入不合规的toolbar会产生错误提示。

@sunsonliu @Saraph1nes 怎么取舍呢?

@Saraph1nes
Copy link
Collaborator

但是 [key: symbol]: any; 会导致之前的版本ts类型不兼容,出现类型错误提示。

当为[key: string]: any;]时:

  1. 如果是当用户不传入自定义的CherryToolbarsCustom的时候识别toolbar的内的每个字段都是string,所以无论传入任何字符串都不会提示类型错误。
  2. 如果用户传入泛型CherryOptions<CustomConfig>时符合正常预期,传入不合规的toolbar会产生错误提示。

当为[key: symbol]: any;]时:

  1. 如果是当用户不传入自定义的CherryToolbarsCustom的时候传入不合规的toolbar会产生错误提示。
  2. 如果用户传入泛型CherryOptions<CustomConfig>时符合正常预期,传入不合规的toolbar会产生错误提示。

@sunsonliu @Saraph1nes 怎么取舍呢?

我觉得[key: symbol]: any;好一点,默认需要校验toolbar的合规性,给用户提示

@Saraph1nes
Copy link
Collaborator

LGTM

@sunsonliu sunsonliu merged commit 588f862 into Tencent:dev Sep 9, 2024
5 checks passed
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.

3 participants