plainheart commented on code in PR #19410:
URL: https://github.com/apache/echarts/pull/19410#discussion_r1429177707
##########
src/export/core.ts:
##########
@@ -93,11 +93,17 @@ type GetDependency<DependencyOption extends
ComponentOption> = {
type GetDependencies<MainType extends string> =
GetDependency<Dependencies[Extract<MainType, DependenciesKeys>]>;
+// Retrieves the keys of a type that are not of type string or number.
+// https://github.com/microsoft/TypeScript/issues/25987#issuecomment-870515762
+type KnownKeys<T> = keyof {
+ [K in keyof T as string extends K ? never : number extends K ? never : K]:
never
+};
+
type ComposeUnitOption<OptionUnion extends ComponentOption> =
// Will be never if some component forget to specify mainType.
CheckMainType<GetMainType<OptionUnion>> &
Omit<EChartsCoreOption, 'baseOption' | 'options'> & {
- [key in GetMainType<OptionUnion>]?: Arrayable<
+ [key in KnownKeys<GetMainType<OptionUnion>>]?: Arrayable<
Review Comment:
Can you explain the detailed reason? I tested this change but it seems wrong.
| Before | After |
| :----: | :----: |
|

|

|
| |

|
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]