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

feat: converted src/APIs to TS #677

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shaikahmadnawaz
Copy link

Describe your changes

This PR converts the src/APIs directory to TypeScript by updating the file extensions from .js to .ts. This change helps improve the maintainability and type safety of the codebase. No logical changes have been made to the files; only the file extensions and necessary type updates have been applied.

Issue ticket number and link

Closed #673

Motivation and Context

The motivation behind this change is to enhance the codebase by leveraging TypeScript's static typing and improved developer tooling. By converting the src/APIs files to TypeScript, we can catch potential type errors during development and improve the overall robustness of the code.

How Has This Been Tested?

No specific tests have been performed for this PR since it primarily involves file extension changes. However, the codebase should be tested after merging this PR to ensure that the application continues to function correctly.

Screenshots (if appropriate):

N/A (No visual changes have been made)

Please review and merge this PR.

@ijemmao
Copy link
Collaborator

ijemmao commented Jun 21, 2023

@shaikahmadnawaz great! can you confirm your changes are working by running yarn test and then attaching a screenshot of the passing test in your PR description?

@shaikahmadnawaz
Copy link
Author

shaikahmadnawaz commented Jun 21, 2023

@shaikahmadnawaz great! can you confirm your changes are working by running yarn test and then attaching a screenshot of the passing test in your PR description?

I got this 👇, check once, how can I pass all tests?

Any .env?

Screenshot 2023-06-21 181508

@ijemmao
Copy link
Collaborator

ijemmao commented Jun 21, 2023

@shaikahmadnawaz there's no need for an env variable - what OS are you running on?

also to confirm, you have MongoDB locally on your machine and Java?

@ijemmao
Copy link
Collaborator

ijemmao commented Jun 22, 2023

@shaikahmadnawaz looks like the pipeline is failing due to a new TS change made in this PR - https://github.com/nkowaokwu/igbo_api/actions/runs/5340617462/jobs/9680629966?pr=677

@shaikahmadnawaz
Copy link
Author

@shaikahmadnawaz looks like the pipeline is failing due to a new TS change made in this PR - https://github.com/nkowaokwu/igbo_api/actions/runs/5340617462/jobs/9680629966?pr=677

The error message indicates that there is a type mismatch in my code. Specifically, the stems property of the Word interface is defined as an array of strings or objects with an optional id property.

Screenshot 2023-06-22 073114

@shaikahmadnawaz
Copy link
Author

@shaikahmadnawaz great! can you confirm your changes are working by running yarn test and then attaching a screenshot of the passing test in your PR description?

Screenshot 2023-06-22 074627

@shaikahmadnawaz
Copy link
Author

One suggestion from my side, check whether this both APIs are working well before merging it to master branch.

@ijemmao
Copy link
Collaborator

ijemmao commented Jun 22, 2023

@shaikahmadnawaz the build step in GitHub is failing as expected since the type checking is failing - you'll need to make the appropriate change to allow TS to pass during the build step - the source of truth to ensure that this change is correct is our GitHub testing pipeline on this PR

@shaikahmadnawaz
Copy link
Author

@shaikahmadnawaz the build step in GitHub is failing as expected since the type checking is failing - you'll need to make the appropriate change to allow TS to pass during the build step - the source of truth to ensure that this change is correct is our GitHub testing pipeline on this PR

Okay, I will work on it.

}: HandleWordFlagsParams) => {
const updatedWords = compact(
words.map((word) => {
let updatedWord = assign({}, word);
Copy link

Choose a reason for hiding this comment

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

Is there a reason why the Loadash is used instead of the native Object.assign method?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nope, just a decision that was made in the past!

const updatedData = assign(data);
interface SetCachedWordsParams {
key: string;
data: any; // Update the type of `data` accordingly
Copy link

Choose a reason for hiding this comment

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

any takes away the benefit of using typescript, avoid if possible

Copy link

Choose a reason for hiding this comment

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

Or better still use the unknown type

@ijemmao
Copy link
Collaborator

ijemmao commented Jul 1, 2023

@shaikahmadnawaz are you still working on this PR?

@shaikahmadnawaz
Copy link
Author

@shaikahmadnawaz are you still working on this PR?

I don't know why it is not working.

@ijemmao
Copy link
Collaborator

ijemmao commented Jul 4, 2023

@shaikahmadnawaz when you see a failing CI test you can click on the details button to see the step where the CI failed:

image

Here's the direct link to the error logs: https://github.com/nkowaokwu/igbo_api/actions/runs/5340819225/jo

Looks like the RedisAPI is throwing the error saying that redis doesn't export RedisClient

Error log

Screen Shot 2023-07-03 at 10 46 51 PM

@shaikahmadnawaz
Copy link
Author

@shaikahmadnawaz when you see a failing CI test you can click on the details button to see the step where the CI failed:

image

Here's the direct link to the error logs: https://github.com/nkowaokwu/igbo_api/actions/runs/5340819225/jo

Looks like the RedisAPI is throwing the error saying that redis doesn't export RedisClient

Error log

Screen Shot 2023-07-03 at 10 46 51 PM

Got it and I removed RedisClient

RedisAPI is throwing the error saying that redis doesn't export RedisClient, so I removed import of this.
src/APIs/RedisAPI.ts Show resolved Hide resolved
src/APIs/RedisAPI.ts Show resolved Hide resolved
src/APIs/RedisAPI.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert src/APIs to TS
4 participants