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

feat: define a serializer child type different from its return type #61

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 22, 2023

Note: This is a WIP! There is a type error in src/serialize.ts.

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR allows a map or function Rich Text serializer to define its child type differently from its return type.

Using different child and return types is necessary when the serialization logic (i.e. serialize() or a custom implemenation using asTree()) cannot pass its children value using the return type. This happens in Svelte.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

🐱

@angeloashmore angeloashmore marked this pull request as draft March 22, 2023 07:41
@github-actions
Copy link

size-limit report 📦

Path Size
dist/index.js 959 B (0%)
dist/index.cjs 1.88 KB (0%)

@codecov-commenter
Copy link

Codecov Report

Merging #61 (3acbadd) into master (d1020ba) will not change coverage.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff            @@
##            master       #61   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          528       605   +77     
  Branches        46        46           
=========================================
+ Hits           528       605   +77     
Impacted Files Coverage Δ
src/composeSerializers.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/serialize.ts 100.00% <100.00%> (ø)
src/types.ts 100.00% <100.00%> (ø)
src/wrapMapSerializer.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lihbr lihbr self-requested a review March 22, 2023 08:29
@angeloashmore angeloashmore marked this pull request as ready for review May 22, 2023 23:02
@angeloashmore angeloashmore marked this pull request as draft May 22, 2023 23:03
Copy link
Member

@lihbr lihbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angeloashmore angeloashmore marked this pull request as ready for review August 15, 2023 21:21
@angeloashmore angeloashmore marked this pull request as draft August 15, 2023 21:38
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