The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Convert CollectionName to TypeScript (#69082)
Fraserb3f643fad67a
diff --git a/frontend/src/metabase/common/components/CollectionName.jsx b/frontend/src/metabase/common/components/CollectionName.tsxsimilarity index 55%rename from frontend/src/metabase/common/components/CollectionName.jsxrename to frontend/src/metabase/common/components/CollectionName.tsxindex 2cfdf57a559..78b5cf25161 100644--- a/frontend/src/metabase/common/components/CollectionName.jsx+++ b/frontend/src/metabase/common/components/CollectionName.tsx@@ -1,13 +1,17 @@-/* eslint-disable react/prop-types */import { Collections, ROOT_COLLECTION } from "metabase/entities/collections";import { useTranslateContent } from "metabase/i18n/hooks";+import type { CollectionId } from "metabase-types/api";-export const CollectionName = ({ id }) => {+interface CollectionNameProps {+ id: CollectionId | null | undefined;+}++export const CollectionName = ({ id }: CollectionNameProps) => {const tc = useTranslateContent();if (id === "root" || id === null) {return <span>{tc(ROOT_COLLECTION.name)}</span>;- } else if (id === undefined || isNaN(id)) {+ } else if (id === undefined || (typeof id === "number" && isNaN(id))) {return null;} else {return <Collections.Name id={id} />;