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

Anti-pattern: (JS-0323) Detected usage of the any type #2030

Open
maleksal opened this issue Jan 31, 2025 · 2 comments · May be fixed by #2039
Open

Anti-pattern: (JS-0323) Detected usage of the any type #2030

maleksal opened this issue Jan 31, 2025 · 2 comments · May be fixed by #2039
Labels
good first issue Good for newcomers

Comments

@maleksal
Copy link
Collaborator

maleksal commented Jan 31, 2025

Description

The any type can sometimes leak into your codebase. TypeScript compiler skips the type checking of the any typed variables, so it creates a potential safety hole, and source of bugs in your codebase. We recommend using unknown or never type variable.

Occurrences

export function validateType(key: string, value: any, type: string) {

getCache.mockResolvedValue([{} as any]);

Guidelines

Reference the issue in your PR description, to close it automatically when your PR is merged

@maleksal maleksal added the good first issue Good for newcomers label Jan 31, 2025
@davido-noowin
Copy link

Hello, I forked the repo to resolve this issue, but leadminer/backend/src/utils/helpers/validation.ts produces errors when the type of value changes from any to unknown or never. The function would need to be changed to replace the any type for value. If you have an alternative solution, however, I can quickly make the change and submit the pull request.

@ankaboot-source ankaboot-source deleted a comment from maleksal Feb 3, 2025
@maleksal
Copy link
Collaborator Author

maleksal commented Feb 3, 2025

Hello, I forked the repo to resolve this issue, but leadminer/backend/src/utils/helpers/validation.ts produces errors when the type of value changes from any to unknown or never. The function would need to be changed to replace the any type for value. If you have an alternative solution, however, I can quickly make the change and submit the pull request.

Hello @davido-noowin, feel free to make the necessary changes, make sure to add unit-tests then submit your PR—we welcome it!

@davido-noowin davido-noowin linked a pull request Feb 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants