Remove @ts-strict-ignore and fix TypeScript errors [hooks]#6115
Remove @ts-strict-ignore and fix TypeScript errors [hooks]#6115lkostrowski wants to merge 1 commit intomainfrom
Conversation
Remove @ts-strict-ignore directives and fix all type errors in hooks: - useWizard.ts: Add explicit number type to goToStep parameter - useLocalPaginator.ts: Convert null to undefined for cursor values - useAddressValidation.ts: Convert undefined to null for addressType - useFilterHandlers.ts: Convert undefined to null for prevAsc ref - useFormset.ts: Add runtime check for getItem and handle undefined additionalData in merge - useListSettings.ts: Add type assertions for AppListViewSettings indexing - makeMutation.ts: Add runtime check for user.logout and type assertion for getMutationStatus - makeQuery.ts: Add type assertions for permissions handling and make opts optional in makeQuery - makeSearch.ts: Add type assertion for variables - makeTopLevelSearch.ts: Add type assertion for loadMore variables - useFilterHandlers.test.ts: Add type assertions and optional chaining for test mocks Add comprehensive tests for useFormset runtime changes: - Test error handling when item not found - Test merge function with undefined additionalData - Test merge function with defined additionalData
|
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6115 +/- ##
==========================================
+ Coverage 39.93% 39.96% +0.02%
==========================================
Files 2419 2419
Lines 40017 40027 +10
Branches 8819 8827 +8
==========================================
+ Hits 15980 15996 +16
+ Misses 24008 24002 -6
Partials 29 29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR systematically removes @ts-strict-ignore directives from hooks and fixes the underlying TypeScript errors in strict mode. The changes focus on proper type handling, null/undefined conversions, runtime safety checks, and appropriate type assertions where the type system cannot infer relationships.
- Adds explicit type annotations and runtime checks to improve type safety
- Converts between null and undefined to match expected type definitions
- Adds comprehensive test coverage for runtime behavior changes in useFormset
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/useWizard.ts | Added explicit number type to goToStep parameter |
| src/hooks/useLocalPaginator.ts | Converted null cursor values to undefined to match PaginationState type |
| src/hooks/useAddressValidation.ts | Converted undefined to null for GraphQL-compatible addressType field |
| src/hooks/useFilterHandlers.ts | Added null coalescing for prevAsc ref assignment |
| src/hooks/useFilterHandlers.test.ts | Added type assertions and optional chaining for test mocks to handle optional values |
| src/hooks/useFormset.ts | Added runtime check for item existence in getItem and conditional merge logic for undefined additionalData |
| src/hooks/useFormset.test.ts | Added comprehensive tests covering error handling and merge function behavior |
| src/hooks/useListSettings.ts | Added type assertions for dynamic settings indexing with listName |
| src/hooks/makeMutation.ts | Added runtime check for optional user.logout method and type assertion for getMutationStatus |
| src/hooks/makeQuery.ts | Added runtime fallback for optional user.logout, made opts optional, changed extraVariables from RequireAtLeastOne to Partial, and added type assertions |
| src/hooks/makeSearch.ts | Added type assertion for variables object to satisfy type constraints |
| src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts | Added type assertion for loadMore variables object |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove @ts-strict-ignore directives and fix all type errors in hooks:
Add comprehensive tests for useFormset runtime changes:
Scope of the change