fix typecheck

This commit is contained in:
7w1 committed 2026-04-30 10:59:59 -05:00
1 parent 122a0e2f25
commit f130f4e2fe
4 files changed
+10 -5

No files matched your search

+2 -2
View File
@@ -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);
});
+6 -1
View File
@@ -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;
@@ -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;
@@ -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;