Finish the TypeScript migration and remove `any` from the store
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 2h 19m
- Merged PRs (30d)
- 30
Description
## Summary
The app is half TypeScript. Eight source files are still plain JS, and they are the ones with the most bugs in this scan:
- `components/EditRestaurantModal/index.js`
- `components/Reviews/CreateNewReview/index.js`
- `components/Reviews/UpdateReview/index.js`
- `components/LoginFormModal/index.js`, `components/SignupFormModal/index.js`
- `components/DeleteRestaurant/index.js`, `components/auth/ProtectedRoute.js` (dead, see the dead-code issue)
- `context/Modal.js`
- `index.js`
In the `.ts` files, `dispatch: any`, `action: any`, `state: any` and `dispatch(... as any)` appear in nearly every thunk and component. `RestaurantActionTypes` in `types/index.ts` doesn't include the search or photo actions, `PhotosState` is `{ [key: string]: any }`, and `CreateRestaurantModal` uses `useSelector((state: any) => ...)`.
## Proposal
- Convert the six live `.js` files to `.tsx`, fixing the separately filed bugs as you go.
- Type the `Modal` context, export typed `useAppDispatch` / `useAppSelector` hooks, and remove `as any`.
- Turn on `noUnusedLocals` and `noUnusedParameters` in `tsconfig.json` once the dead-code issue is done.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with types/index.ts and tsconfig.json, then compare the six live JavaScript components and context/Modal.js with the existing TypeScript files. Check the thunk and component usages of dispatch, action, state, PhotosState, and RestaurantActionTypes. Done means the live files are converted to .tsx, the listed any casts and annotations are removed, typed app hooks and Modal context are exported, and the unused-code checks can be enabled after the dead-code issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100