Skip to content

Comments

Remove @ts-strict-ignore and fix TypeScript errors [hooks]#6115

Draft
lkostrowski wants to merge 1 commit intomainfrom
claude/fix-typescript-strict-mode-01JrUDqDrVQQPQg8UfWJrqjp
Draft

Remove @ts-strict-ignore and fix TypeScript errors [hooks]#6115
lkostrowski wants to merge 1 commit intomainfrom
claude/fix-typescript-strict-mode-01JrUDqDrVQQPQg8UfWJrqjp

Conversation

@lkostrowski
Copy link
Member

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

Scope of the change

  • I confirm I added ripples for changes (see src/ripples) or my feature doesn't contain any user-facing changes
  • I used analytics "trackEvent" for important events

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
Copilot AI review requested due to automatic review settings November 22, 2025 22:06
@changeset-bot
Copy link

changeset-bot bot commented Nov 22, 2025

⚠️ No Changeset found

Latest commit: 8e052da

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.96%. Comparing base (b7b0ed1) to head (8e052da).

Files with missing lines Patch % Lines
src/hooks/makeMutation.ts 0.00% 2 Missing ⚠️
src/hooks/useAddressValidation.ts 0.00% 1 Missing ⚠️
src/hooks/useWizard.ts 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a 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 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.

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.

3 participants