-
Notifications
You must be signed in to change notification settings - Fork 3
fix: eliminate any types #54
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
base: main
Are you sure you want to change the base?
Conversation
- Proper types in utils, store, components - Type guards for table data - Enable ESLint any detection
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves TypeScript type safety by replacing any types with more specific and appropriate types throughout the codebase. The changes enable the @typescript-eslint/no-explicit-any rule to be set to "warn" in the ESLint configuration.
- Replaced
anywithunknownornever[]where type information is genuinely unavailable - Added proper type guards and interfaces for better type checking
- Fixed type assertions to use
as unknown as Tpattern for necessary coercions - Added explicit return types to store slice creator functions
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/resolvers.ts | Changed type assertions from as any to as unknown as string for position data conversions |
| src/utils/middleware.ts | Changed SWR middleware parameter type from any[] to unknown[] |
| src/utils/helpers.ts | Changed generic constraint from any[] to never[] for throttle function parameters |
| src/utils/array.ts | Added interfaces (HasDenom, HasSymbol, HasToken) to replace any parameter types |
| src/types/classes/BNCoin.ts | Added explicit return type to toSignedCoin() method |
| src/types/app.d.ts | Added type annotations to interface properties (accounts, creditAccounts, hlsAccounts, resetStettingsModal, nullable icon) |
| src/store/slices/modal.ts | Added explicit ModalSlice return type to slice creator |
| src/store/slices/common.ts | Added explicit CommonSlice return type to slice creator |
| src/store/index.ts | Added explicit Store return type to store creator |
| src/hooks/tokenomics/useOverviewChartData.ts | Changed parameter type from any to OverviewData | null | undefined |
| src/hooks/charts/useChartDataTransform.ts | Extended union type to include OverviewData | null | undefined |
| src/components/common/Table/Row.tsx | Added type guards and replaced any casts with proper type checking |
| src/components/common/Chart/common/Legend/ChartLegend.tsx | Changed index signature and array element type from any to unknown and Record<string, unknown>[] |
| src/components/common/Chart/PieChart/PieChartBody.tsx | Replaced any with PieLabelRenderProps and added type guards for numeric properties |
| src/app/api/og/perps/[market]/route.tsx | Added proper parameter typing and replaced any error handling with type-safe approach |
| src/api/assets/getDexAssets.ts | Changed variable type from any[] to AstroportAsset[] |
| eslint.config.mjs | Enabled @typescript-eslint/no-explicit-any rule as "warn" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
anydetection