diff --git a/src/patcher/paragraph-token-replacer.ts b/src/patcher/paragraph-token-replacer.ts index fe3583c0e8b..b961c646b9c 100644 --- a/src/patcher/paragraph-token-replacer.ts +++ b/src/patcher/paragraph-token-replacer.ts @@ -43,6 +43,7 @@ export const replaceTokenInParagraphElement = ({ patchTextElement(paragraphElement.elements![run.index].elements![index], firstPart); replaceMode = ReplaceMode.MIDDLE; continue; + /* c8 ignore next 2 */ } break; case ReplaceMode.MIDDLE: @@ -59,6 +60,7 @@ export const replaceTokenInParagraphElement = ({ patchTextElement(paragraphElement.elements![run.index].elements![index], ""); } break; + /* c8 ignore next */ default: } } diff --git a/src/patcher/replacer.ts b/src/patcher/replacer.ts index 8ae2f4f9a61..2ca7f9f3483 100644 --- a/src/patcher/replacer.ts +++ b/src/patcher/replacer.ts @@ -55,17 +55,18 @@ export const replacer = ( let patchedRightElement = right; if (keepOriginalStyles) { - const runElementNonTextualElements = - runElementToBeReplaced.elements?.filter((e) => e.type === "element" && e.name !== "w:t") ?? []; + const runElementNonTextualElements = runElementToBeReplaced.elements!.filter( + (e) => e.type === "element" && e.name !== "w:t", + ); newRunElements = textJson.map((e) => ({ ...e, - elements: [...runElementNonTextualElements, ...(e.elements ?? [])], + elements: [...runElementNonTextualElements, ...e.elements!], })); patchedRightElement = { ...right, - elements: [...runElementNonTextualElements, ...(right.elements ?? [])], + elements: [...runElementNonTextualElements, ...right.elements!], }; }