Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to typescript #50

Draft
wants to merge 55 commits into
base: main
Choose a base branch
from
Draft

Refactor to typescript #50

wants to merge 55 commits into from

Conversation

kweeuhree
Copy link
Collaborator

@kweeuhree kweeuhree commented Sep 17, 2024

Description

This code proposes refactoring our application to TypeScript. These changes will keep the app type safe, scalable and easy to read and to debug.
Some console logs are still in place as the work is still in progress.

Issue

closes #56

Type of Changes

enhancement

Updates

Added types.

Issues

  • Duplicate items are still being added;
  • New items are being added on refresh - this affects normalization and duplicate check

Testing Steps / QA Criteria

  • Ran npm start and navigated to localhost:3000,
  • Logged in,
  • Added a new list,
  • Added unique and duplicate items to a new list,
  • Shared new list,
  • Verified that list will be only shared when the list is owned by the user that is currently logged in.

- install types and necessary dependencies;
- add TypeScript configuration;
- change extention of files to .tsx;
- add User and Item types.
@kweeuhree kweeuhree self-assigned this Sep 17, 2024
@kweeuhree kweeuhree added help wanted Extra attention is needed refactoring labels Sep 17, 2024
Comment on lines 28 to 29
userId: string | null | undefined,
userEmail: string | null | undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this might simplify a little bit

Suggested change
userId: string | null | undefined,
userEmail: string | null | undefined,
userId?: string | null,
userEmail?: string | null,

tsconfig.json Outdated
Comment on lines 1 to 13
{
"compilerOptions": {
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react-jsx",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src"]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build works on my end now with the vite command.

I wonder if it was the file name change from vit2.config.js > vite.config.ts that did it.

I also see the built files in /build too which makes things nicer. 🙌🏻

@kweeuhree kweeuhree changed the title Refactor to typescript attempt Refactor to typescript Sep 26, 2024
…and firebase.ts;

 - add types to firebase functions;
- add types to a new deleteItem function;
Copy link

github-actions bot commented Sep 26, 2024

Visit the preview URL for this PR (updated for commit 0400b4c):

https://tcl-75-smart-shopping-list--pr50-refactor-to-typescri-pom1hab6.web.app

(expires Fri, 04 Oct 2024 14:54:00 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1f1fd53c369e1fa31e15c310aa075b4e8f4f8dde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed refactoring
Projects
None yet
2 participants