feat: define a serializer child type different from its return type
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)
- [x] 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.
- [x] All TSDoc comments are up-to-date and new ones have been added where necessary.
- [x] All new and existing tests are passing.
🐱
size-limit report 📦
| Path | Size |
|---|---|
| dist/index.js | 959 B (0%) |
| dist/index.cjs | 1.88 KB (0%) |
Codecov Report
Merging #61 (3acbadd) into master (d1020ba) will not change coverage. The diff coverage is
100.00%.
:mega: 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.