Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(core): stabilize TextX flatMap type inference (#7695)

wpxp1234569dfc505bfcf7
diff --git a/packages/core/src/docs/data-model/text-x/custom-range-update.ts b/packages/core/src/docs/data-model/text-x/custom-range-update.ts
index 0f32642647..6d8ebc2c1c 100644
--- a/packages/core/src/docs/data-model/text-x/custom-range-update.ts
+++ b/packages/core/src/docs/data-model/text-x/custom-range-update.ts
@@ -137,7 +137,7 @@ export function getRangeUpdates(actions: TextXAction[]): NonNullable<IRetainActi
// Identity edits must never enter the positional iterator: an insertion may
// split every character of a retain, or a deletion may consume it altogether.
export function withoutRangeUpdates(actions: TextXAction[]): TextXAction[] {
- return actions.flatMap((action) => {
+ return actions.flatMap((action): TextXAction[] => {
if (action.t === TextXActionType.INSERT && action.len > 1 &&
Array.from(action.body.dataStream).every((token) => token === DataStreamTreeTokenType.CUSTOM_RANGE_START || token === DataStreamTreeTokenType.CUSTOM_RANGE_END)) {
return Array.from(action.body.dataStream, (_, index) => ({