refactor(editor): cleanup ts-expect-error (#9369)
This commit is contained in:
@@ -34,7 +34,7 @@ export const insertLinkByQuickSearchCommand: Command<
|
||||
|
||||
// add normal link;
|
||||
if ('externalUrl' in result) {
|
||||
// @ts-expect-error TODO: fix after bookmark refactor
|
||||
// @ts-expect-error FIXME: fix after bookmark refactor
|
||||
std.command.exec('insertBookmark', { url: result.externalUrl });
|
||||
return {
|
||||
flavour: 'affine:bookmark',
|
||||
|
||||
@@ -242,7 +242,7 @@ export async function copyImageBlob(
|
||||
}
|
||||
|
||||
try {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error FIXME: BS-2239
|
||||
if (window.apis?.clipboard?.copyAsImageFromString) {
|
||||
const dataURL = await convertToString(blob);
|
||||
if (!dataURL)
|
||||
@@ -250,7 +250,7 @@ export async function copyImageBlob(
|
||||
ErrorCode.DefaultRuntimeError,
|
||||
'Cant convert a blob to data URL.'
|
||||
);
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error FIXME: BS-2239
|
||||
await window.apis.clipboard?.copyAsImageFromString(dataURL);
|
||||
} else {
|
||||
// DOMException: Type image/jpeg not supported on write.
|
||||
|
||||
@@ -44,7 +44,7 @@ export class LatexBlockComponent extends CaptionedBlockComponent<LatexBlockModel
|
||||
const latex = this.model.latex$.value;
|
||||
|
||||
katexContainer.replaceChildren();
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error lit hack won't fix
|
||||
delete katexContainer['_$litPart$'];
|
||||
|
||||
if (latex.length === 0) {
|
||||
@@ -60,7 +60,7 @@ export class LatexBlockComponent extends CaptionedBlockComponent<LatexBlockModel
|
||||
});
|
||||
} catch {
|
||||
katexContainer.replaceChildren();
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error lit hack won't fix
|
||||
delete katexContainer['_$litPart$'];
|
||||
render(
|
||||
html`<span class="latex-block-error-placeholder"
|
||||
|
||||
@@ -21,7 +21,7 @@ export function forwardDelete(std: BlockStdScope) {
|
||||
const ignoreForwardDeleteFlavourList: BlockSuite.Flavour[] = [
|
||||
'affine:attachment',
|
||||
'affine:bookmark',
|
||||
// @ts-expect-error TODO: should be fixed after database model is migrated to affine-models
|
||||
// @ts-expect-error FIXME: should be fixed after database model is migrated to affine-models
|
||||
'affine:database',
|
||||
'affine:code',
|
||||
'affine:image',
|
||||
|
||||
@@ -86,7 +86,7 @@ export function mergeWithPrev(editorHost: EditorHost, model: BlockModel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// @ts-expect-error TODO: should be fixed after database model is migrated to affine-models
|
||||
// @ts-expect-error FIXME: should be fixed after database model is migrated to affine-models
|
||||
if (matchFlavours(parent, ['affine:database'])) {
|
||||
doc.deleteBlock(model);
|
||||
focusTextModel(editorHost.std, prevBlock.id, prevBlock.text?.yText.length);
|
||||
|
||||
@@ -482,7 +482,7 @@ export const LatexExtension = InlineMarkdownExtension({
|
||||
if (!latexBlock || latexBlock.flavour !== 'affine:latex') return;
|
||||
|
||||
//FIXME(@Flrande): wait for refactor
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error BS-2241
|
||||
latexBlock.toggleEditor();
|
||||
})
|
||||
.catch(console.error);
|
||||
|
||||
@@ -58,10 +58,7 @@ export class AffineLatexNode extends SignalWatcher(
|
||||
gap: 10px;
|
||||
|
||||
border-radius: 4px;
|
||||
background: ${
|
||||
// @ts-expect-error FIXME: ts error
|
||||
unsafeCSSVarV2('label/red')
|
||||
};
|
||||
background: ${unsafeCSSVarV2('chip/label/red')};
|
||||
|
||||
color: ${unsafeCSSVarV2('text/highlight/fg/red')};
|
||||
font-family: Inter;
|
||||
@@ -126,7 +123,7 @@ export class AffineLatexNode extends SignalWatcher(
|
||||
if (!latexContainer) return;
|
||||
|
||||
latexContainer.replaceChildren();
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error lit hack won't fix
|
||||
delete latexContainer['_$litPart$'];
|
||||
|
||||
if (latex.length === 0) {
|
||||
@@ -142,7 +139,7 @@ export class AffineLatexNode extends SignalWatcher(
|
||||
});
|
||||
} catch {
|
||||
latexContainer.replaceChildren();
|
||||
// @ts-expect-error FIXME: ts error
|
||||
// @ts-expect-error lit hack won't fix
|
||||
delete latexContainer['_$litPart$'];
|
||||
render(
|
||||
html`<span class="error-placeholder">Error equation</span>`,
|
||||
|
||||
@@ -110,8 +110,7 @@ const compareAny = (a: unknown, b: unknown) => {
|
||||
if (!b) {
|
||||
return Compare.LT;
|
||||
}
|
||||
// @ts-expect-error FIXME: ts error
|
||||
return a - b;
|
||||
return Number(a) - Number(b);
|
||||
};
|
||||
|
||||
const compareTag = (type: DataTypeOf<typeof t.tag>, a: unknown, b: unknown) => {
|
||||
|
||||
@@ -499,10 +499,9 @@ export const mindmapStyleGetters: Record<MindmapStyle, MindmapStyleGetter> = {
|
||||
|
||||
export const applyNodeStyle = (node: MindmapNode, nodeStyle: NodeStyle) => {
|
||||
Object.entries(nodeStyle).forEach(([key, value]) => {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
if (!isEqual(node.element[key], value)) {
|
||||
// @ts-expect-error FIXME: ts error
|
||||
node.element[key] = value;
|
||||
const element = node.element as unknown as Record<string, unknown>;
|
||||
if (!isEqual(element[key], value)) {
|
||||
element[key] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user