mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
refactor(editor): cleanup ts-expect-error (#9369)
This commit is contained in:
@@ -175,8 +175,8 @@ export const replaceIdMiddleware: JobMiddleware = ({ slots, collection }) => {
|
||||
break;
|
||||
}
|
||||
case 'group': {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
const json = value.children.json as Record<string, unknown>;
|
||||
const json = (value.children as Record<string, unknown>)
|
||||
.json as Record<string, unknown>;
|
||||
Object.entries(json).forEach(([key, value]) => {
|
||||
if (idMap.has(key)) {
|
||||
delete json[key];
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type BlockHtmlAdapterMatcher,
|
||||
HastUtils,
|
||||
} from '@blocksuite/affine-shared/adapters';
|
||||
import type { DeltaInsert } from '@blocksuite/inline';
|
||||
import { nanoid } from '@blocksuite/store';
|
||||
import { bundledLanguagesInfo, codeToHast } from 'shiki';
|
||||
|
||||
@@ -74,16 +75,15 @@ export const codeBlockHtmlAdapterMatcher: BlockHtmlAdapterMatcher = {
|
||||
)?.id ?? 'text')
|
||||
: 'text';
|
||||
|
||||
// @ts-expect-error FIXME: ts error
|
||||
const text = o.node.props.text.delta as DeltaInsert[];
|
||||
const text = (o.node.props.text as Record<string, unknown>)
|
||||
.delta as DeltaInsert[];
|
||||
const code = text.map(delta => delta.insert).join('');
|
||||
const hast = await codeToHast(code, {
|
||||
lang: matchedLang,
|
||||
theme: 'light-plus',
|
||||
});
|
||||
|
||||
// @ts-expect-error FIXME: ts error
|
||||
walkerContext.openNode(hast, 'children').closeNode();
|
||||
walkerContext.openNode(hast as never, 'children').closeNode();
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ export function cloneDeep<T>(obj: T): T {
|
||||
seen.set(val, copy);
|
||||
|
||||
Object.keys(val).forEach(key => {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error deep clone
|
||||
copy[key] = clone(val[key]);
|
||||
});
|
||||
|
||||
|
||||
@@ -319,8 +319,7 @@ export class EdgelessChangeTextMenu extends WithDisposable(LitElement) {
|
||||
|
||||
const key = this.elementType === 'connector' ? 'labelStyle' : 'color';
|
||||
this.elements.forEach(ele => {
|
||||
// @ts-expect-error: FIXME
|
||||
ele[event.type === 'start' ? 'stash' : 'pop'](key);
|
||||
ele[event.type === 'start' ? 'stash' : 'pop'](key as 'color');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ export const edgelessToBlob = async (
|
||||
};
|
||||
|
||||
export const writeImageBlobToClipboard = async (blob: Blob) => {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error FIXME: BS-2239
|
||||
if (window.apis?.clipboard?.copyAsImageFromString) {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error FIXME: BS-2239
|
||||
await window.apis.clipboard?.copyAsImageFromString(blob);
|
||||
} else {
|
||||
await navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })]);
|
||||
|
||||
Reference in New Issue
Block a user