From a745fcb9b39fa4bc13bc454c8be195fa373de02c Mon Sep 17 00:00:00 2001 From: Palash Gupta Date: Mon, 25 Jul 2022 12:50:14 +0530 Subject: [PATCH] chore: utils/index.js is updated to .ts (#46556) * test: utils index is updated to ts * chore: utils.js is added into the .gitignore and .prettierignore --- .gitignore | 1 + .prettierignore | 3 ++- utils/{index.js => index.ts} | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) rename utils/{index.js => index.ts} (89%) diff --git a/.gitignore b/.gitignore index c5ec8a11980..e9c7c8db8a2 100644 --- a/.gitignore +++ b/.gitignore @@ -168,6 +168,7 @@ config/certification-settings.js ### Generated utils files ### utils/slugs.js utils/slugs.test.js +utils/index.js ### vim ### # Swap diff --git a/.prettierignore b/.prettierignore index 8e56696477f..688a16d9c73 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,6 +11,7 @@ client/i18n/**/*.json docs/i18n utils/slugs.js utils/slugs.test.js +utils/index.js **/package-lock.json web/.next -curriculum-server/data/curriculum.json +curriculum-server/data/curriculum.json \ No newline at end of file diff --git a/utils/index.js b/utils/index.ts similarity index 89% rename from utils/index.js rename to utils/index.ts index 84d39c21c70..3a4b3b31633 100644 --- a/utils/index.js +++ b/utils/index.ts @@ -21,11 +21,11 @@ const idToTitle = new Map( }) ); -const idToPath = new Map(); +const idToPath = new Map(); // Keep the timeline slugs the same so // we don't break existing links -const specialPaths = { +const specialPaths: Record = { 'Legacy Full Stack': 'Full Stack', 'Legacy Information Security and Quality Assurance': 'Information Security and Quality Assurance', @@ -45,5 +45,5 @@ for (const [id, title] of idToTitle) { } export const getCertIds = () => idToPath.keys(); -export const getPathFromID = id => idToPath.get(id); -export const getTitleFromId = id => idToTitle.get(id); +export const getPathFromID = (id: string) => idToPath.get(id); +export const getTitleFromId = (id: string) => idToTitle.get(id);