Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Convert UsefulQuestions to TypeScript (#69069)

Fraserbdb2ce7daeeb
diff --git a/frontend/src/metabase/reference/components/UsefulQuestions.jsx b/frontend/src/metabase/reference/components/UsefulQuestions.tsx
similarity index 72%
rename from frontend/src/metabase/reference/components/UsefulQuestions.jsx
rename to frontend/src/metabase/reference/components/UsefulQuestions.tsx
index 6eda56b6cc9..1f91e323144 100644
--- a/frontend/src/metabase/reference/components/UsefulQuestions.jsx
+++ b/frontend/src/metabase/reference/components/UsefulQuestions.tsx
@@ -1,29 +1,30 @@
-import PropTypes from "prop-types";
import { memo } from "react";
import { t } from "ttag";
import { QueryButton } from "metabase/common/components/QueryButton";
import D from "metabase/reference/components/Detail.module.css";
+import type { IconName } from "metabase/ui";
import S from "./UsefulQuestions.module.css";
-const UsefulQuestions = ({ questions }) => (
+interface UsefulQuestionsProps {
+ questions: { text: string; icon: IconName; link: string }[];
+}
+
+const UsefulQuestions = ({ questions }: UsefulQuestionsProps) => (
<div className={D.detail}>
<div className={D.detailBody}>
<div className={D.detailTitle}>
<span>{t`Potentially useful questions`}</span>
</div>
<div className={S.usefulQuestions}>
- {questions.map((question, index, questions) => (
+ {questions.map((question, index) => (
<QueryButton key={index} {...question} />
))}
</div>
</div>
</div>
);
-UsefulQuestions.propTypes = {
- questions: PropTypes.array.isRequired,
-};
// eslint-disable-next-line import/no-default-export -- deprecated usage
export default memo(UsefulQuestions);