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

Ray fix/unsafe any assignment #7

Merged
merged 3 commits into from
Aug 31, 2024
Merged

Conversation

mrahmed2026
Copy link
Collaborator

@mrahmed2026 mrahmed2026 commented Aug 31, 2024

Issue Addressed:

The issue involved an unsafe assignment of an any type value in the TypeScript code

Changes Made:

TypeScript Types: Added explicit TypeScript types to the function parameters and return types to ensure type safety and prevent the use of 'any' type.
Code Refactoring: Updated the function to use Request and Response types

@mrahmed2026 mrahmed2026 linked an issue Aug 31, 2024 that may be closed by this pull request
Copy link
Collaborator

@SarimFaraz SarimFaraz left a comment

Choose a reason for hiding this comment

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

I can see the issue assigned to you #3 was resolved along with other issues, however some assigned issues still remain. In order to fix the remaining issues, look at the code below:

import { Request, Response } from 'express';
import fibonacci from './fib';

// Endpoint for querying the fibonacci numbers
export default (req: Request, res: Response) => {
const { num } = req.params as { num: string };

const parsedNum: number = parseInt(num, 10);
const fibN: number = fibonacci(parsedNum);
let result = fibonacci(${num}) is ${fibN};

if (fibN < 0) {
result = fibonacci(${num}) is undefined;
}

res.send(result);
};

@mrahmed2026
Copy link
Collaborator Author

I made changes based on your review and it unfortuantely didnt work out, so i reverted back to my original reviewed changes

@mrahmed2026 mrahmed2026 merged commit 2f92c16 into main Aug 31, 2024
1 check failed
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.

test: src/fibRoute.ts#L3
2 participants