From a574ff36fa0f1a75b67a975bff123a0169e35f7d Mon Sep 17 00:00:00 2001 From: Josh Levy Date: Tue, 3 Jun 2025 18:39:52 -0400 Subject: [PATCH] chore: migrate to TypeScript --- app.config.js => app.config.ts | 0 app/(app)/{_layout.jsx => _layout.tsx} | 0 app/(app)/{classes.jsx => classes.tsx} | 0 app/(app)/{index.jsx => index.tsx} | 0 app/(app)/{settings.jsx => settings.tsx} | 0 app/{_layout.jsx => _layout.tsx} | 0 app/{add-assignment.jsx => add-assignment.tsx} | 0 app/{add-class.jsx => add-class.tsx} | 0 app/{all-classes.jsx => all-classes.tsx} | 0 app/{edit-assignment.jsx => edit-assignment.tsx} | 0 app/{edit-class.jsx => edit-class.tsx} | 0 app/{sign-in.jsx => sign-in.tsx} | 0 components/auth/{Input.jsx => Input.tsx} | 0 components/auth/{SocialButton.jsx => SocialButton.tsx} | 0 components/auth/{index.jsx => index.tsx} | 0 components/class/{Assignment.jsx => Assignment.tsx} | 0 components/class/{Class.jsx => Class.tsx} | 0 components/class/{ClassCard.jsx => ClassCard.tsx} | 0 components/class/{ColorPicker.jsx => ColorPicker.tsx} | 0 ...tisfactionRangesModal.jsx => SatisfactionRangesModal.tsx} | 0 components/class/{SemesterModal.jsx => SemesterModal.tsx} | 0 components/class/{index.js => index.ts} | 0 components/common/{BaseModal.jsx => BaseModal.tsx} | 0 components/common/{Button.jsx => Button.tsx} | 0 components/common/{ButtonInput.jsx => ButtonInput.tsx} | 0 components/common/{GradeSelect.jsx => GradeSelect.tsx} | 0 components/common/{Input.jsx => Input.tsx} | 0 .../common/{InputDatePicker.jsx => InputDatePicker.tsx} | 0 components/common/{Loader.jsx => Loader.tsx} | 0 components/common/{NumberInput.jsx => NumberInput.tsx} | 0 .../common/{PageModalHeader.jsx => PageModalHeader.tsx} | 0 components/common/{SelectModal.jsx => SelectModal.tsx} | 0 components/common/{Switch.jsx => Switch.tsx} | 0 components/common/{Text.jsx => Text.tsx} | 0 components/common/{TextArea.jsx => TextArea.tsx} | 0 components/common/{index.js => index.ts} | 0 constants/{accentColors.js => accentColors.ts} | 0 constants/{assignmentTypes.js => assignmentTypes.ts} | 0 constants/{satisfactionRanges.js => satisfactionRanges.ts} | 0 constants/{semesters.js => semesters.ts} | 0 constants/{toastConfig.js => toastConfig.ts} | 0 constants/{weatherIcons.js => weatherIcons.ts} | 0 contexts/{index.js => index.ts} | 0 contexts/{supabase.js => supabase.tsx} | 0 contexts/{theme.js => theme.tsx} | 0 hooks/{index.js => index.ts} | 0 hooks/{useDateRange.js => useDateRange.ts} | 0 hooks/{useInputField.js => useInputField.ts} | 0 hooks/{useWarmUpBrowser.js => useWarmUpBrowser.ts} | 0 lib/{supabase.js => supabase.ts} | 0 package.json | 5 ++++- queries/{classes.js => classes.ts} | 0 queries/{users.js => users.ts} | 0 tailwind.config.js | 5 ++++- jsconfig.json => tsconfig.json | 4 +++- utils/{capitalize.js => capitalize.ts} | 0 ...formatSatisfactionRange.js => formatSatisfactionRange.ts} | 0 utils/{getRandomAccentColor.js => getRandomAccentColor.ts} | 0 utils/{getWeatherIcon.js => getWeatherIcon.ts} | 0 utils/{index.js => index.ts} | 0 utils/{isValidInput.js => isValidInput.ts} | 0 utils/{onSignInWithOauth.js => onSignInWithOauth.ts} | 0 utils/{pluralize.js => pluralize.ts} | 0 63 files changed, 11 insertions(+), 3 deletions(-) rename app.config.js => app.config.ts (100%) rename app/(app)/{_layout.jsx => _layout.tsx} (100%) rename app/(app)/{classes.jsx => classes.tsx} (100%) rename app/(app)/{index.jsx => index.tsx} (100%) rename app/(app)/{settings.jsx => settings.tsx} (100%) rename app/{_layout.jsx => _layout.tsx} (100%) rename app/{add-assignment.jsx => add-assignment.tsx} (100%) rename app/{add-class.jsx => add-class.tsx} (100%) rename app/{all-classes.jsx => all-classes.tsx} (100%) rename app/{edit-assignment.jsx => edit-assignment.tsx} (100%) rename app/{edit-class.jsx => edit-class.tsx} (100%) rename app/{sign-in.jsx => sign-in.tsx} (100%) rename components/auth/{Input.jsx => Input.tsx} (100%) rename components/auth/{SocialButton.jsx => SocialButton.tsx} (100%) rename components/auth/{index.jsx => index.tsx} (100%) rename components/class/{Assignment.jsx => Assignment.tsx} (100%) rename components/class/{Class.jsx => Class.tsx} (100%) rename components/class/{ClassCard.jsx => ClassCard.tsx} (100%) rename components/class/{ColorPicker.jsx => ColorPicker.tsx} (100%) rename components/class/{SatisfactionRangesModal.jsx => SatisfactionRangesModal.tsx} (100%) rename components/class/{SemesterModal.jsx => SemesterModal.tsx} (100%) rename components/class/{index.js => index.ts} (100%) rename components/common/{BaseModal.jsx => BaseModal.tsx} (100%) rename components/common/{Button.jsx => Button.tsx} (100%) rename components/common/{ButtonInput.jsx => ButtonInput.tsx} (100%) rename components/common/{GradeSelect.jsx => GradeSelect.tsx} (100%) rename components/common/{Input.jsx => Input.tsx} (100%) rename components/common/{InputDatePicker.jsx => InputDatePicker.tsx} (100%) rename components/common/{Loader.jsx => Loader.tsx} (100%) rename components/common/{NumberInput.jsx => NumberInput.tsx} (100%) rename components/common/{PageModalHeader.jsx => PageModalHeader.tsx} (100%) rename components/common/{SelectModal.jsx => SelectModal.tsx} (100%) rename components/common/{Switch.jsx => Switch.tsx} (100%) rename components/common/{Text.jsx => Text.tsx} (100%) rename components/common/{TextArea.jsx => TextArea.tsx} (100%) rename components/common/{index.js => index.ts} (100%) rename constants/{accentColors.js => accentColors.ts} (100%) rename constants/{assignmentTypes.js => assignmentTypes.ts} (100%) rename constants/{satisfactionRanges.js => satisfactionRanges.ts} (100%) rename constants/{semesters.js => semesters.ts} (100%) rename constants/{toastConfig.js => toastConfig.ts} (100%) rename constants/{weatherIcons.js => weatherIcons.ts} (100%) rename contexts/{index.js => index.ts} (100%) rename contexts/{supabase.js => supabase.tsx} (100%) rename contexts/{theme.js => theme.tsx} (100%) rename hooks/{index.js => index.ts} (100%) rename hooks/{useDateRange.js => useDateRange.ts} (100%) rename hooks/{useInputField.js => useInputField.ts} (100%) rename hooks/{useWarmUpBrowser.js => useWarmUpBrowser.ts} (100%) rename lib/{supabase.js => supabase.ts} (100%) rename queries/{classes.js => classes.ts} (100%) rename queries/{users.js => users.ts} (100%) rename jsconfig.json => tsconfig.json (62%) rename utils/{capitalize.js => capitalize.ts} (100%) rename utils/{formatSatisfactionRange.js => formatSatisfactionRange.ts} (100%) rename utils/{getRandomAccentColor.js => getRandomAccentColor.ts} (100%) rename utils/{getWeatherIcon.js => getWeatherIcon.ts} (100%) rename utils/{index.js => index.ts} (100%) rename utils/{isValidInput.js => isValidInput.ts} (100%) rename utils/{onSignInWithOauth.js => onSignInWithOauth.ts} (100%) rename utils/{pluralize.js => pluralize.ts} (100%) diff --git a/app.config.js b/app.config.ts similarity index 100% rename from app.config.js rename to app.config.ts diff --git a/app/(app)/_layout.jsx b/app/(app)/_layout.tsx similarity index 100% rename from app/(app)/_layout.jsx rename to app/(app)/_layout.tsx diff --git a/app/(app)/classes.jsx b/app/(app)/classes.tsx similarity index 100% rename from app/(app)/classes.jsx rename to app/(app)/classes.tsx diff --git a/app/(app)/index.jsx b/app/(app)/index.tsx similarity index 100% rename from app/(app)/index.jsx rename to app/(app)/index.tsx diff --git a/app/(app)/settings.jsx b/app/(app)/settings.tsx similarity index 100% rename from app/(app)/settings.jsx rename to app/(app)/settings.tsx diff --git a/app/_layout.jsx b/app/_layout.tsx similarity index 100% rename from app/_layout.jsx rename to app/_layout.tsx diff --git a/app/add-assignment.jsx b/app/add-assignment.tsx similarity index 100% rename from app/add-assignment.jsx rename to app/add-assignment.tsx diff --git a/app/add-class.jsx b/app/add-class.tsx similarity index 100% rename from app/add-class.jsx rename to app/add-class.tsx diff --git a/app/all-classes.jsx b/app/all-classes.tsx similarity index 100% rename from app/all-classes.jsx rename to app/all-classes.tsx diff --git a/app/edit-assignment.jsx b/app/edit-assignment.tsx similarity index 100% rename from app/edit-assignment.jsx rename to app/edit-assignment.tsx diff --git a/app/edit-class.jsx b/app/edit-class.tsx similarity index 100% rename from app/edit-class.jsx rename to app/edit-class.tsx diff --git a/app/sign-in.jsx b/app/sign-in.tsx similarity index 100% rename from app/sign-in.jsx rename to app/sign-in.tsx diff --git a/components/auth/Input.jsx b/components/auth/Input.tsx similarity index 100% rename from components/auth/Input.jsx rename to components/auth/Input.tsx diff --git a/components/auth/SocialButton.jsx b/components/auth/SocialButton.tsx similarity index 100% rename from components/auth/SocialButton.jsx rename to components/auth/SocialButton.tsx diff --git a/components/auth/index.jsx b/components/auth/index.tsx similarity index 100% rename from components/auth/index.jsx rename to components/auth/index.tsx diff --git a/components/class/Assignment.jsx b/components/class/Assignment.tsx similarity index 100% rename from components/class/Assignment.jsx rename to components/class/Assignment.tsx diff --git a/components/class/Class.jsx b/components/class/Class.tsx similarity index 100% rename from components/class/Class.jsx rename to components/class/Class.tsx diff --git a/components/class/ClassCard.jsx b/components/class/ClassCard.tsx similarity index 100% rename from components/class/ClassCard.jsx rename to components/class/ClassCard.tsx diff --git a/components/class/ColorPicker.jsx b/components/class/ColorPicker.tsx similarity index 100% rename from components/class/ColorPicker.jsx rename to components/class/ColorPicker.tsx diff --git a/components/class/SatisfactionRangesModal.jsx b/components/class/SatisfactionRangesModal.tsx similarity index 100% rename from components/class/SatisfactionRangesModal.jsx rename to components/class/SatisfactionRangesModal.tsx diff --git a/components/class/SemesterModal.jsx b/components/class/SemesterModal.tsx similarity index 100% rename from components/class/SemesterModal.jsx rename to components/class/SemesterModal.tsx diff --git a/components/class/index.js b/components/class/index.ts similarity index 100% rename from components/class/index.js rename to components/class/index.ts diff --git a/components/common/BaseModal.jsx b/components/common/BaseModal.tsx similarity index 100% rename from components/common/BaseModal.jsx rename to components/common/BaseModal.tsx diff --git a/components/common/Button.jsx b/components/common/Button.tsx similarity index 100% rename from components/common/Button.jsx rename to components/common/Button.tsx diff --git a/components/common/ButtonInput.jsx b/components/common/ButtonInput.tsx similarity index 100% rename from components/common/ButtonInput.jsx rename to components/common/ButtonInput.tsx diff --git a/components/common/GradeSelect.jsx b/components/common/GradeSelect.tsx similarity index 100% rename from components/common/GradeSelect.jsx rename to components/common/GradeSelect.tsx diff --git a/components/common/Input.jsx b/components/common/Input.tsx similarity index 100% rename from components/common/Input.jsx rename to components/common/Input.tsx diff --git a/components/common/InputDatePicker.jsx b/components/common/InputDatePicker.tsx similarity index 100% rename from components/common/InputDatePicker.jsx rename to components/common/InputDatePicker.tsx diff --git a/components/common/Loader.jsx b/components/common/Loader.tsx similarity index 100% rename from components/common/Loader.jsx rename to components/common/Loader.tsx diff --git a/components/common/NumberInput.jsx b/components/common/NumberInput.tsx similarity index 100% rename from components/common/NumberInput.jsx rename to components/common/NumberInput.tsx diff --git a/components/common/PageModalHeader.jsx b/components/common/PageModalHeader.tsx similarity index 100% rename from components/common/PageModalHeader.jsx rename to components/common/PageModalHeader.tsx diff --git a/components/common/SelectModal.jsx b/components/common/SelectModal.tsx similarity index 100% rename from components/common/SelectModal.jsx rename to components/common/SelectModal.tsx diff --git a/components/common/Switch.jsx b/components/common/Switch.tsx similarity index 100% rename from components/common/Switch.jsx rename to components/common/Switch.tsx diff --git a/components/common/Text.jsx b/components/common/Text.tsx similarity index 100% rename from components/common/Text.jsx rename to components/common/Text.tsx diff --git a/components/common/TextArea.jsx b/components/common/TextArea.tsx similarity index 100% rename from components/common/TextArea.jsx rename to components/common/TextArea.tsx diff --git a/components/common/index.js b/components/common/index.ts similarity index 100% rename from components/common/index.js rename to components/common/index.ts diff --git a/constants/accentColors.js b/constants/accentColors.ts similarity index 100% rename from constants/accentColors.js rename to constants/accentColors.ts diff --git a/constants/assignmentTypes.js b/constants/assignmentTypes.ts similarity index 100% rename from constants/assignmentTypes.js rename to constants/assignmentTypes.ts diff --git a/constants/satisfactionRanges.js b/constants/satisfactionRanges.ts similarity index 100% rename from constants/satisfactionRanges.js rename to constants/satisfactionRanges.ts diff --git a/constants/semesters.js b/constants/semesters.ts similarity index 100% rename from constants/semesters.js rename to constants/semesters.ts diff --git a/constants/toastConfig.js b/constants/toastConfig.ts similarity index 100% rename from constants/toastConfig.js rename to constants/toastConfig.ts diff --git a/constants/weatherIcons.js b/constants/weatherIcons.ts similarity index 100% rename from constants/weatherIcons.js rename to constants/weatherIcons.ts diff --git a/contexts/index.js b/contexts/index.ts similarity index 100% rename from contexts/index.js rename to contexts/index.ts diff --git a/contexts/supabase.js b/contexts/supabase.tsx similarity index 100% rename from contexts/supabase.js rename to contexts/supabase.tsx diff --git a/contexts/theme.js b/contexts/theme.tsx similarity index 100% rename from contexts/theme.js rename to contexts/theme.tsx diff --git a/hooks/index.js b/hooks/index.ts similarity index 100% rename from hooks/index.js rename to hooks/index.ts diff --git a/hooks/useDateRange.js b/hooks/useDateRange.ts similarity index 100% rename from hooks/useDateRange.js rename to hooks/useDateRange.ts diff --git a/hooks/useInputField.js b/hooks/useInputField.ts similarity index 100% rename from hooks/useInputField.js rename to hooks/useInputField.ts diff --git a/hooks/useWarmUpBrowser.js b/hooks/useWarmUpBrowser.ts similarity index 100% rename from hooks/useWarmUpBrowser.js rename to hooks/useWarmUpBrowser.ts diff --git a/lib/supabase.js b/lib/supabase.ts similarity index 100% rename from lib/supabase.js rename to lib/supabase.ts diff --git a/package.json b/package.json index 311b711..c0882ad 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,10 @@ "yup": "^1.4.0" }, "devDependencies": { - "@babel/core": "^7.20.0" + "@babel/core": "^7.20.0", + "typescript": "^5.3.3", + "@types/react": "~18.2.0", + "@types/react-native": "~0.73.4" }, "private": true } diff --git a/queries/classes.js b/queries/classes.ts similarity index 100% rename from queries/classes.js rename to queries/classes.ts diff --git a/queries/users.js b/queries/users.ts similarity index 100% rename from queries/users.js rename to queries/users.ts diff --git a/tailwind.config.js b/tailwind.config.js index 25c1f70..12028cf 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,7 +2,10 @@ const { theme } = require("./theme"); /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./app/**/*.{js,jsx}", "./components/**/*.{js,jsx}"], + content: [ + "./app/**/*.{js,jsx,ts,tsx}", + "./components/**/*.{js,jsx,ts,tsx}", + ], presets: [require("nativewind/preset")], theme, plugins: [], diff --git a/jsconfig.json b/tsconfig.json similarity index 62% rename from jsconfig.json rename to tsconfig.json index cd11622..07a880d 100644 --- a/jsconfig.json +++ b/tsconfig.json @@ -1,9 +1,11 @@ { + "extends": "expo/tsconfig.base", "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] }, + "jsxImportSource": "nativewind" }, "exclude": ["node_modules"] -} \ No newline at end of file +} diff --git a/utils/capitalize.js b/utils/capitalize.ts similarity index 100% rename from utils/capitalize.js rename to utils/capitalize.ts diff --git a/utils/formatSatisfactionRange.js b/utils/formatSatisfactionRange.ts similarity index 100% rename from utils/formatSatisfactionRange.js rename to utils/formatSatisfactionRange.ts diff --git a/utils/getRandomAccentColor.js b/utils/getRandomAccentColor.ts similarity index 100% rename from utils/getRandomAccentColor.js rename to utils/getRandomAccentColor.ts diff --git a/utils/getWeatherIcon.js b/utils/getWeatherIcon.ts similarity index 100% rename from utils/getWeatherIcon.js rename to utils/getWeatherIcon.ts diff --git a/utils/index.js b/utils/index.ts similarity index 100% rename from utils/index.js rename to utils/index.ts diff --git a/utils/isValidInput.js b/utils/isValidInput.ts similarity index 100% rename from utils/isValidInput.js rename to utils/isValidInput.ts diff --git a/utils/onSignInWithOauth.js b/utils/onSignInWithOauth.ts similarity index 100% rename from utils/onSignInWithOauth.js rename to utils/onSignInWithOauth.ts diff --git a/utils/pluralize.js b/utils/pluralize.ts similarity index 100% rename from utils/pluralize.js rename to utils/pluralize.ts