Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

The mergeDeeply function in src/components/merge.ts used type assertions to coerce union types, triggering 6 no-unsafe-type-assertion warnings.

Changes:

  • Replaced generic mergeDeeply with dedicated type-safe merge functions per component type
  • mergeBlockComponent, mergeListComponent, mergeListItemComponent handle union types (function | object) with proper type guards
  • mergeMarksComponent, mergeTypesComponent handle record types without assertions

Before:

return {
  block: mergeDeeply(parent, overrides, 'block') as PortableTextHtmlComponents['block'],
  // ... 5 more unsafe assertions
}

After:

return {
  block: mergeBlockComponent(parent.block, overrides.block),
  list: mergeListComponent(parent.list, overrides.list),
  // ... type-safe merges
}

Each merge function's return type is explicitly typed, allowing TypeScript to verify type safety without assertions.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2025

⚠️ No Changeset found

Latest commit: 55ce3bd

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

Copilot AI changed the title [WIP] Enable no unsafe type assertion in codebase Remove unsafe type assertions from component merging Dec 9, 2025
Copilot AI requested a review from stipsan December 9, 2025 19:27
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.

2 participants