From f130f4e2fe3dbf85a4a0eba3196efd844cbd1642 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Thu, 30 Apr 2026 10:59:59 -0500 Subject: [PATCH] fix typecheck --- src/app/components/editor/getLinks.test.ts | 4 ++-- src/app/components/editor/slate.d.ts | 7 ++++++- src/app/plugins/markdown/extensions/matrix-spoiler.ts | 2 +- src/app/plugins/markdown/extensions/matrix-subscript.ts | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/components/editor/getLinks.test.ts b/src/app/components/editor/getLinks.test.ts index e3dd0b73f..1244a2682 100644 --- a/src/app/components/editor/getLinks.test.ts +++ b/src/app/components/editor/getLinks.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { getLinks, toPlainText } from './output'; -import type { ParagraphElement } from './slate'; +import type { CustomElement, ParagraphElement } from './slate'; import { BlockType } from './types'; describe('getLinks', () => { @@ -42,7 +42,7 @@ describe('getLinks', () => { }, ], }; - const links = getLinks([node as any]); + const links = getLinks([node as unknown as CustomElement]); expect(links).toHaveLength(0); }); diff --git a/src/app/components/editor/slate.d.ts b/src/app/components/editor/slate.d.ts index 05c8b5aec..ba67b277c 100644 --- a/src/app/components/editor/slate.d.ts +++ b/src/app/components/editor/slate.d.ts @@ -47,7 +47,12 @@ export type CommandElement = { children: Text[]; }; -export type InlineElement = Text | LinkElement | MentionElement | EmoticonElement | CommandElement; +export type InlineElement = + | FormattedText + | LinkElement + | MentionElement + | EmoticonElement + | CommandElement; export type ParagraphElement = { type: BlockType.Paragraph; diff --git a/src/app/plugins/markdown/extensions/matrix-spoiler.ts b/src/app/plugins/markdown/extensions/matrix-spoiler.ts index c7415d3d9..30bc2cba4 100644 --- a/src/app/plugins/markdown/extensions/matrix-spoiler.ts +++ b/src/app/plugins/markdown/extensions/matrix-spoiler.ts @@ -22,7 +22,7 @@ export const matrixSpoilerExtension = { text: match[1], tokens: [] as Tokens.Generic[], }; - this.lexer.inlineTokens(token.text, token.tokens); + this.lexer.inlineTokens(token.text!, token.tokens); return token; } return undefined; diff --git a/src/app/plugins/markdown/extensions/matrix-subscript.ts b/src/app/plugins/markdown/extensions/matrix-subscript.ts index f8385772d..922f9377d 100644 --- a/src/app/plugins/markdown/extensions/matrix-subscript.ts +++ b/src/app/plugins/markdown/extensions/matrix-subscript.ts @@ -19,7 +19,7 @@ export const matrixSubscriptExtension = { text: match[1], tokens: [] as Tokens.Generic[], }; - this.lexer.inlineTokens(token.text, token.tokens); + this.lexer.inlineTokens(token.text!, token.tokens); return token; } return undefined;