geido commented on code in PR #27030:
URL: https://github.com/apache/superset/pull/27030#discussion_r1480372020
##########
superset-frontend/src/components/AlteredSliceTag/index.tsx:
##########
@@ -27,53 +26,84 @@ import { Tooltip } from 'src/components/Tooltip';
import ModalTrigger from '../ModalTrigger';
import TableView from '../TableView';
-const propTypes = {
- origFormData: PropTypes.object.isRequired,
- currentFormData: PropTypes.object.isRequired,
-};
+// Define interfaces for props and state
+interface FormData {
+ [key: string]: any; // Use a more specific type if possible for your form
data
+}
+
+interface AlteredSliceTagProps {
+ origFormData: FormData;
+ currentFormData: FormData;
+}
+
+interface ControlMap {
+ [key: string]: {
+ label?: string;
+ type?: string;
+ };
+}
+
+interface Diff {
+ before: any; // Specify a more precise type if possible
+ after: any; // Specify a more precise type if possible
+}
+
+interface Row {
+ control: string;
+ before: string;
+ after: string;
+}
+
+interface AlteredSliceTagState {
+ rows: Row[];
+ hasDiffs: boolean;
+ controlsMap: ControlMap;
+}
const StyledLabel = styled.span`
${({ theme }) => `
font-size: ${theme.typography.sizes.s}px;
color: ${theme.colors.grayscale.dark1};
background-color: ${theme.colors.alert.base};
- &: hover {
+ &:hover {
background-color: ${theme.colors.alert.dark1};
}
`}
`;
-function alterForComparison(value) {
- // Considering `[]`, `{}`, `null` and `undefined` as identical
- // for this purpose
+function alterForComparison(value: any): any {
Review Comment:
all `any` here should use appropriate types
##########
superset-frontend/src/components/AlteredSliceTag/index.tsx:
##########
@@ -27,53 +26,84 @@ import { Tooltip } from 'src/components/Tooltip';
import ModalTrigger from '../ModalTrigger';
import TableView from '../TableView';
-const propTypes = {
- origFormData: PropTypes.object.isRequired,
- currentFormData: PropTypes.object.isRequired,
-};
+// Define interfaces for props and state
+interface FormData {
+ [key: string]: any; // Use a more specific type if possible for your form
data
+}
+
+interface AlteredSliceTagProps {
+ origFormData: FormData;
+ currentFormData: FormData;
+}
+
+interface ControlMap {
+ [key: string]: {
+ label?: string;
+ type?: string;
+ };
+}
+
+interface Diff {
+ before: any; // Specify a more precise type if possible
+ after: any; // Specify a more precise type if possible
Review Comment:
`any` should be avoided
##########
superset-frontend/src/components/AlteredSliceTag/index.tsx:
##########
@@ -27,53 +26,84 @@ import { Tooltip } from 'src/components/Tooltip';
import ModalTrigger from '../ModalTrigger';
import TableView from '../TableView';
-const propTypes = {
- origFormData: PropTypes.object.isRequired,
- currentFormData: PropTypes.object.isRequired,
-};
+// Define interfaces for props and state
+interface FormData {
+ [key: string]: any; // Use a more specific type if possible for your form
data
Review Comment:
Please use a more specific type for this
--
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]