Skip to content

Commit

Permalink
refactor: coerce types rather than @ts-expect-error
Browse files Browse the repository at this point in the history
This result isn't great either so this can be changed if a better
solution exists.
  • Loading branch information
angeloashmore committed Jun 25, 2021
1 parent ab61226 commit c423b5b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wrapMapSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ export const wrapMapSerializer = <SerializerReturnType>(
): RichTextFunctionSerializer<SerializerReturnType | null> => {
return (type, node, text, children, key) => {
const tagSerializer: RichTextMapSerializer<SerializerReturnType>[keyof RichTextMapSerializer<SerializerReturnType>] =
// @ts-expect-error if not at reversed map then at type itself
mapSerializer[RichTextReversedNodeType[type] || type];
mapSerializer[
(RichTextReversedNodeType[
type as keyof typeof RichTextReversedNodeType
] || type) as keyof RichTextMapSerializer<SerializerReturnType>
];

if (tagSerializer) {
return tagSerializer({
Expand Down

0 comments on commit c423b5b

Please sign in to comment.