You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/02/28 10:49:23 UTC

[GitHub] [superset] michael-s-molina commented on a change in pull request #18952: fix(select): fix typing for customLabel

michael-s-molina commented on a change in pull request #18952:
URL: https://github.com/apache/superset/pull/18952#discussion_r815774520



##########
File path: superset-frontend/src/components/Select/Select.tsx
##########
@@ -44,7 +43,21 @@ import { hasOption } from './utils';
 
 const { Option } = AntdSelect;
 
-type AntdSelectAllProps = AntdSelectProps<AntdSelectValue>;
+export type RawValue = string | number;
+
+export interface LabeledValue {
+  key?: string;
+  value: RawValue;
+  label: ReactNode;
+  customLabel?: ReactNode;
+}
+
+export type RawValues = RawValue[];
+export type LabeledValues = LabeledValue[];
+export type SelectValue = RawValue | LabeledValue | RawValues | LabeledValues;

Review comment:
       Just a nit, but do you think we could make `SelectValue` internal instead of exporting it? I can see the use cases for the other types but I think when we are using a Select we already defined if their values will be `RawValue` or `LabeledValue`. Considering that we are not mixing the types for the same Select.




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org