diff --git a/packages/slate-commons/src/commands/alignment.ts b/packages/slate-commons/src/commands/alignment.ts index 565fc54b8..e13d822ca 100644 --- a/packages/slate-commons/src/commands/alignment.ts +++ b/packages/slate-commons/src/commands/alignment.ts @@ -1,7 +1,7 @@ import type { AlignableNode, Alignment } from '@prezly/slate-types'; import { isAlignableElement, isTableCellNode } from '@prezly/slate-types'; -import type { SlateEditor } from '@udecode/plate-common'; -import type { Node, NodeEntry, Path } from 'slate'; +import { getAboveNode, type SlateEditor, type TNodeEntry } from '@udecode/plate-common'; +import type { Node, Path } from 'slate'; export function getAlignment(editor: SlateEditor, defaultAlignment: Alignment): Alignment[] { const nodes = editor.nodes({ @@ -31,7 +31,7 @@ export function toggleAlignment(editor: SlateEditor, align: Alignment | undefine ); } -function isAlignmentRoot([node, path]: NodeEntry): boolean { +function isAlignmentRoot([node, path]: TNodeEntry): boolean { // We allow aligning elements either at top-level or inside table cells. return path.length === 0 || isTableCellNode(node); } @@ -41,6 +41,6 @@ function isTopLevelAlignableElement( node: Node, path: Path, ): node is AlignableNode { - const parent = editor.above({ at: path }); + const parent = getAboveNode(editor, { at: path }); return parent !== undefined && isAlignmentRoot(parent) && isAlignableElement(node); } diff --git a/packages/slate-commons/src/commands/getCurrentNodeEntry.ts b/packages/slate-commons/src/commands/getCurrentNodeEntry.ts index 64306e6d8..aacbabc00 100644 --- a/packages/slate-commons/src/commands/getCurrentNodeEntry.ts +++ b/packages/slate-commons/src/commands/getCurrentNodeEntry.ts @@ -1,12 +1,12 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; +import type { TNodeEntry} from '@udecode/plate-common'; +import { getNodeEntry, type SlateEditor } from '@udecode/plate-common'; import { isSelectionValid } from './isSelectionValid'; -export function getCurrentNodeEntry(editor: SlateEditor): NodeEntry | null { +export function getCurrentNodeEntry(editor: SlateEditor): TNodeEntry | null { if (!editor.selection || !isSelectionValid(editor)) { return null; } - return editor.node(editor.selection, { depth: 1 }); + return getNodeEntry(editor, editor.selection, { depth: 1}) ?? null; } diff --git a/packages/slate-commons/src/commands/index.ts b/packages/slate-commons/src/commands/index.ts index e4e605b84..aedb96327 100644 --- a/packages/slate-commons/src/commands/index.ts +++ b/packages/slate-commons/src/commands/index.ts @@ -23,7 +23,6 @@ export { } from './isCursorOnEdgeOfContainer'; export { isEmpty } from './isEmpty'; export { isEmptyParagraphElement } from './isEmptyParagraphElement'; -export { isInline } from './isInline'; export { isMarkActive } from './isMarkActive'; export { isNodeEmpty } from './isNodeEmpty'; export { isSelectionAtBlockEnd } from './isSelectionAtBlockEnd'; diff --git a/packages/slate-commons/src/commands/insertNodes.ts b/packages/slate-commons/src/commands/insertNodes.ts index c72afc170..b87d8074b 100644 --- a/packages/slate-commons/src/commands/insertNodes.ts +++ b/packages/slate-commons/src/commands/insertNodes.ts @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ import type { SlateEditor } from '@udecode/plate-common'; +import { isElement, isInline } from '@udecode/plate-common'; import type { Node } from 'slate'; import { Text } from 'slate'; @@ -9,7 +10,6 @@ import { insertEmptyParagraph } from './insertEmptyParagraph'; import { isAtEmptyBlock } from './isAtEmptyBlock'; import { isBlock } from './isBlock'; import { isCursorInEmptyParagraph } from './isCursorInEmptyParagraph'; -import { isInline } from './isInline'; import { isVoid } from './isVoid'; import { roughlyNormalizeNodes } from './roughly-normalize'; @@ -40,8 +40,7 @@ function insertNormalizedNodes(editor: SlateEditor, nodes: Node[], options: Opti // In case we're inserting things into an empty paragraph, we will want to replace that paragraph. const initialSelection = editor.selection; const isInitialSelectionAtEmptyBlock = isAtEmptyBlock(editor); - // @ts-expect-error TODO: Fix this - const isAppendingToCurrentNode = Text.isText(nodes[0]) || editor.isInline(nodes[0]); + const isAppendingToCurrentNode = Text.isText(nodes[0]) || isInline(editor, nodes[0]); const isInsertingBlockNodes = nodes.some((node) => isBlock(editor, node)); for (const node of nodes) { @@ -54,7 +53,7 @@ function insertNormalizedNodes(editor: SlateEditor, nodes: Node[], options: Opti insertEmptyParagraph(editor); } - if (isInline(editor, node)) { + if (isElement(node) && isInline(editor, node)) { // Slate does not allow inline nodes next to inline nodes. // Adding text nodes around it helps to prevent unwanted side-effects. // @@ -64,7 +63,6 @@ function insertNormalizedNodes(editor: SlateEditor, nodes: Node[], options: Opti // > nor can it be next to another inline node in the children array. // > If this is the case, an empty text node will be added to correct // > this to be in compliance with the constraint. - // @ts-expect-error TODO: Fix this editor.insertFragment([{ text: '' }, node, { text: '' }]); } else { editor.insertNodes([node], { mode }); diff --git a/packages/slate-commons/src/commands/isBlock.ts b/packages/slate-commons/src/commands/isBlock.ts index 279388b76..21482d29f 100644 --- a/packages/slate-commons/src/commands/isBlock.ts +++ b/packages/slate-commons/src/commands/isBlock.ts @@ -1,6 +1,7 @@ +import type { TNode} from '@udecode/plate-common'; import { isElement, type SlateEditor } from '@udecode/plate-common'; import type { Node } from 'slate'; -export function isBlock(editor: SlateEditor, node: Node): boolean { +export function isBlock(editor: SlateEditor, node: Node | TNode): boolean { return isElement(node) && editor.isBlock(node); } diff --git a/packages/slate-commons/src/commands/isInline.ts b/packages/slate-commons/src/commands/isInline.ts deleted file mode 100644 index a7ef5d548..000000000 --- a/packages/slate-commons/src/commands/isInline.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { isElement, type SlateEditor } from '@udecode/plate-common'; -import type { Node } from 'slate'; - -export function isInline(editor: SlateEditor, node: Node): boolean { - return isElement(node) && editor.isInline(node); -} diff --git a/packages/slate-commons/src/commands/isVoid.ts b/packages/slate-commons/src/commands/isVoid.ts index 09f28ffed..86dd4ed9f 100644 --- a/packages/slate-commons/src/commands/isVoid.ts +++ b/packages/slate-commons/src/commands/isVoid.ts @@ -1,6 +1,7 @@ +import type { TNode} from '@udecode/plate-common'; import { isElement, type SlateEditor } from '@udecode/plate-common'; import type { Node } from 'slate'; -export function isVoid(editor: SlateEditor, node: Node): boolean { +export function isVoid(editor: SlateEditor, node: Node | TNode): boolean { return isElement(node) && editor.isVoid(node); } diff --git a/packages/slate-commons/src/commands/removeChildren.ts b/packages/slate-commons/src/commands/removeChildren.ts index 2c54edbba..b534a6896 100644 --- a/packages/slate-commons/src/commands/removeChildren.ts +++ b/packages/slate-commons/src/commands/removeChildren.ts @@ -1,20 +1,18 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; -import { Element, Text } from 'slate'; +import { isElement, isText, type SlateEditor, type TNodeEntry } from '@udecode/plate-common'; /** * Ensures given element has a single, empty `Text` child. * Returns `true` when removal occurred. * Returns `false` when nothing changed. */ -export function removeChildren(editor: SlateEditor, [node, path]: NodeEntry): boolean { - if (!Element.isElement(node)) { +export function removeChildren(editor: SlateEditor, [node, path]: TNodeEntry): boolean { + if (!isElement(node)) { return false; } const [child] = node.children; - if (node.children.length === 1 && Text.isText(child) && child.text.length === 0) { + if (node.children.length === 1 && isText(child) && child.text.length === 0) { return false; } diff --git a/packages/slate-commons/src/commands/toDomNode.ts b/packages/slate-commons/src/commands/toDomNode.ts index cd880632f..9a8cc471b 100644 --- a/packages/slate-commons/src/commands/toDomNode.ts +++ b/packages/slate-commons/src/commands/toDomNode.ts @@ -1,8 +1,6 @@ -import type { SlateEditor } from '@udecode/plate-common'; +import type { SlateEditor, TNode } from '@udecode/plate-common'; import { toDOMNode } from '@udecode/plate-common/react'; -import type { Node } from 'slate'; -export function toDomNode(editor: SlateEditor, node: Node): HTMLElement | null { - // @ts-expect-error TODO: Fix this +export function toDomNode(editor: SlateEditor, node: TNode): HTMLElement | null { return toDOMNode(editor, node) ?? null; } diff --git a/packages/slate-editor/src/extensions/button-block/ButtonBlockNode.ts b/packages/slate-editor/src/extensions/button-block/ButtonBlockNode.ts index ba1fe9cd4..a9e0496ed 100644 --- a/packages/slate-editor/src/extensions/button-block/ButtonBlockNode.ts +++ b/packages/slate-editor/src/extensions/button-block/ButtonBlockNode.ts @@ -1,5 +1,6 @@ import type { ElementNode } from '@prezly/slate-types'; import { isElementNode } from '@prezly/slate-types'; +import type { TNode } from '@udecode/plate-common'; import type { Node } from 'slate'; type Uuid = string; @@ -29,7 +30,7 @@ export namespace ButtonBlockNode { OUTLINE = 'outline', } - export function isButtonBlockNode(node: Node): node is ButtonBlockNode { + export function isButtonBlockNode(node: Node | TNode): node is ButtonBlockNode { return isElementNode(node, Type); } } diff --git a/packages/slate-editor/src/extensions/button-block/lib/insertButtonBlock.ts b/packages/slate-editor/src/extensions/button-block/lib/insertButtonBlock.ts index 0d1243804..70601180f 100644 --- a/packages/slate-editor/src/extensions/button-block/lib/insertButtonBlock.ts +++ b/packages/slate-editor/src/extensions/button-block/lib/insertButtonBlock.ts @@ -1,8 +1,9 @@ import { EditorCommands } from '@prezly/slate-commons'; import type { Alignment } from '@prezly/slate-types'; import { isAlignableElement, isImageNode } from '@prezly/slate-types'; -import type { SlateEditor } from '@udecode/plate-common'; -import { Node, Path, Range } from 'slate'; +import { type SlateEditor } from '@udecode/plate-common'; +import type { Node} from 'slate'; +import { Path, Range } from 'slate'; import type { ButtonBlockNode } from '../ButtonBlockNode'; @@ -36,8 +37,8 @@ function prevBlock(editor: SlateEditor): Node | undefined { if (editor.selection && Range.isCollapsed(editor.selection)) { const topLevelPath = editor.selection.focus.path.slice(0, 1); if (Path.hasPrevious(topLevelPath)) { - // @ts-expect-error TODO: Fix this - return Node.get(editor, Path.previous(topLevelPath)); + const [node] = editor.node(Path.previous(topLevelPath)); + return node; } } return undefined; diff --git a/packages/slate-editor/src/extensions/floating-add-menu/FloatingAddMenu.tsx b/packages/slate-editor/src/extensions/floating-add-menu/FloatingAddMenu.tsx index d9d3a6f37..362019909 100644 --- a/packages/slate-editor/src/extensions/floating-add-menu/FloatingAddMenu.tsx +++ b/packages/slate-editor/src/extensions/floating-add-menu/FloatingAddMenu.tsx @@ -5,13 +5,13 @@ import { isHeadingNode, isParagraphNode, } from '@prezly/slate-types'; +import { getNodeString } from '@udecode/plate-common'; import { useEditorState } from '@udecode/plate-common/react'; import classNames from 'classnames'; import { isHotkey } from 'is-hotkey'; import type { KeyboardEvent, RefObject } from 'react'; import React, { useEffect, useState } from 'react'; import type { Modifier } from 'react-popper'; -import { Node } from 'slate'; import { TooltipV2 } from '#components'; import { useKeyboardNavigation, useSize } from '#lib'; @@ -138,7 +138,7 @@ export function FloatingAddMenu({ const isParagraph = isParagraphNode(currentNode); const isHeading1 = isHeadingNode(currentNode, HEADING_1_NODE_TYPE); const isHeading2 = isHeadingNode(currentNode, HEADING_2_NODE_TYPE); - const text = currentNode ? Node.string(currentNode) : ''; + const text = currentNode ? getNodeString(currentNode) : ''; return ( 0 && value.every(Node.isNode); + return value.length > 0 && value.every(isNode); } diff --git a/packages/slate-editor/src/extensions/paste-slate-content/lib/withSlatePasting.ts b/packages/slate-editor/src/extensions/paste-slate-content/lib/withSlatePasting.ts index dfbad6087..c9d9e56bc 100644 --- a/packages/slate-editor/src/extensions/paste-slate-content/lib/withSlatePasting.ts +++ b/packages/slate-editor/src/extensions/paste-slate-content/lib/withSlatePasting.ts @@ -25,7 +25,6 @@ export function withSlatePasting(isPreservedBlock: IsPreservedBlock) { } if (editor.selection) { - // @ts-expect-error TODO: Fix this editor.insertFragment(fragment); } else { editor.insertNodes(fragment); diff --git a/packages/slate-editor/src/extensions/placeholders/PlaceholderNode.ts b/packages/slate-editor/src/extensions/placeholders/PlaceholderNode.ts index c8fea0ffe..92d5d687a 100644 --- a/packages/slate-editor/src/extensions/placeholders/PlaceholderNode.ts +++ b/packages/slate-editor/src/extensions/placeholders/PlaceholderNode.ts @@ -1,5 +1,6 @@ import type { ElementNode } from '@prezly/slate-types'; import { isElementNode } from '@prezly/slate-types'; +import type { TNode } from '@udecode/plate-common'; import type { Node } from 'slate'; type Uuid = string; @@ -55,24 +56,24 @@ export namespace PlaceholderNode { WEB_BOOKMARK = 'placeholder:bookmark', } - export function isPlaceholderNode(node: Node): node is PlaceholderNode; + export function isPlaceholderNode(node: Node | TNode): node is PlaceholderNode; export function isPlaceholderNode( - node: Node, + node: Node | TNode, type: T, ): node is PlaceholderNode; export function isPlaceholderNode( - node: Node, + node: Node | TNode, types: T[], ): node is PlaceholderNode; export function isPlaceholderNode( - node: Node, + node: Node | TNode, type: `${T}`, ): node is PlaceholderNode; - export function isPlaceholderNode(node: Node, type?: string | string[]): boolean { + export function isPlaceholderNode(node: Node | TNode, type?: string | string[]): boolean { if (typeof type === 'string') { return isElementNode(node, type); } @@ -82,14 +83,14 @@ export namespace PlaceholderNode { return isElementNode(node, Object.values(Type)); } - export function isSameAs(placeholder: T, node: Node): node is T; - export function isSameAs(placeholder: T): (node: Node) => node is T; + export function isSameAs(placeholder: T, node: Node | TNode): node is T; + export function isSameAs(placeholder: T): (node: Node | TNode) => node is T; export function isSameAs( placeholder: T, - node?: Node, - ): boolean | ((node: Node) => boolean) { + node?: Node | TNode, + ): boolean | ((node: Node | TNode) => boolean) { if (!node) { - return (node: Node): node is T => { + return (node: Node | TNode): node is T => { return ( PlaceholderNode.isPlaceholderNode(node, placeholder.type) && node.uuid === placeholder.uuid diff --git a/packages/slate-editor/src/extensions/snippet/lib/useFloatingSnippetInput.ts b/packages/slate-editor/src/extensions/snippet/lib/useFloatingSnippetInput.ts index f3c613d24..61209f4cc 100644 --- a/packages/slate-editor/src/extensions/snippet/lib/useFloatingSnippetInput.ts +++ b/packages/slate-editor/src/extensions/snippet/lib/useFloatingSnippetInput.ts @@ -47,8 +47,7 @@ export function useFloatingSnippetInput(editor: SlateEditor): [State, Actions] { EditorCommands.insertNodes(editor, node.children, { mode: 'highest' }); - // TODO: Fix this! - // editor.flash(node.children.at(0), node.children.at(-1)); + editor.flash(node.children.at(0), node.children.at(-1)); savedSelection.restore(editor, { focus: true }); } catch (error) { console.error(error); diff --git a/packages/slate-editor/src/lib/withResetFormattingOnBreak.ts b/packages/slate-editor/src/lib/withResetFormattingOnBreak.ts index 94305414a..53ba50f6e 100644 --- a/packages/slate-editor/src/lib/withResetFormattingOnBreak.ts +++ b/packages/slate-editor/src/lib/withResetFormattingOnBreak.ts @@ -1,17 +1,11 @@ import { EditorCommands } from '@prezly/slate-commons'; -import type { SlateEditor } from '@udecode/plate-common'; -import type { Node } from 'slate'; +import type { SlateEditor, TNode } from '@udecode/plate-common'; -export function withResetFormattingOnBreak(match: (node: Node) => boolean) { +export function withResetFormattingOnBreak(match: (node: TNode) => boolean) { return function (editor: T): T { const { insertBreak } = editor; editor.insertBreak = () => { - /** - * The `currentNode` is the top-level block, which means when the - * cursor is at a list item, the type is bulleted or numbered list. - * This is why we have to perform `isList` check and not `isListItem`. - */ const [currentNode] = EditorCommands.getCurrentNodeEntry(editor) || []; if (currentNode && match(currentNode) && EditorCommands.isSelectionAtBlockEnd(editor)) { diff --git a/packages/slate-editor/src/modules/editor/Editor.tsx b/packages/slate-editor/src/modules/editor/Editor.tsx index 88470c825..2d376b41c 100644 --- a/packages/slate-editor/src/modules/editor/Editor.tsx +++ b/packages/slate-editor/src/modules/editor/Editor.tsx @@ -841,11 +841,9 @@ export const Editor = forwardRef((props, forwardedRef) = * in two" work as expected. */ onChange(value); - // variables.onChange(editor); - // userMentions.onChange(editor); + variables.onChange(editor); + userMentions.onChange(editor); }} - // @ts-expect-error TODO: Fix this - initialValue={getInitialValue()} > {(combinedDecorate) => ( diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/convertToParagraph.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/convertToParagraph.ts index 5f758bc72..779577633 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/convertToParagraph.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/convertToParagraph.ts @@ -1,11 +1,10 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; +import type { SlateEditor, TNodeEntry } from '@udecode/plate-common'; import { createParagraph } from '#extensions/paragraphs'; import { isInlineNode } from '../queries'; -export function convertToParagraph(editor: SlateEditor, [node, path]: NodeEntry) { +export function convertToParagraph(editor: SlateEditor, [node, path]: TNodeEntry) { if (isInlineNode(node)) { editor.wrapNodes(createParagraph(), { at: path }); return true; diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertParagraph.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertParagraph.ts index 585a28e55..dcad138c1 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertParagraph.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertParagraph.ts @@ -1,9 +1,8 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; +import type { SlateEditor, TNodeEntry } from '@udecode/plate-common'; import { createParagraph } from '#extensions/paragraphs'; -export function insertParagraph(editor: SlateEditor, [node, path]: NodeEntry) { +export function insertParagraph(editor: SlateEditor, [node, path]: TNodeEntry) { editor.insertNodes([createParagraph()], { at: path, match: (n) => n === node }); return true; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeNoSplit.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeNoSplit.ts index 53f4594b3..780f9cc80 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeNoSplit.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeNoSplit.ts @@ -1,11 +1,10 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import { Element, Path } from 'slate'; -import type { NodeEntry } from 'slate'; +import { isElement, type SlateEditor, type TNodeEntry } from '@udecode/plate-common'; +import { Path } from 'slate'; /** * This fixer just moves node up, without parent node splitting */ -export function liftNodeNoSplit(editor: SlateEditor, [, path]: NodeEntry) { +export function liftNodeNoSplit(editor: SlateEditor, [, path]: TNodeEntry) { const ancestor = editor.above({ at: path }); if (!ancestor) { @@ -14,7 +13,7 @@ export function liftNodeNoSplit(editor: SlateEditor, [, path]: NodeEntry) { const [ancestorNode] = ancestor; - if (!Element.isElement(ancestorNode)) { + if (!isElement(ancestorNode)) { return false; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeWithSplit.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeWithSplit.ts index 8904f3173..12dc97f4f 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeWithSplit.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/liftNodeWithSplit.ts @@ -1,12 +1,10 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import { Element } from 'slate'; -import type { NodeEntry } from 'slate'; +import { getAboveNode, isElement, type SlateEditor, type TNodeEntry } from '@udecode/plate-common'; /** * This fixer can split parent node */ -export function liftNodeWithSplit(editor: SlateEditor, [, path]: NodeEntry) { - const ancestor = editor.above({ at: path }); +export function liftNodeWithSplit(editor: SlateEditor, [, path]: TNodeEntry) { + const ancestor = getAboveNode(editor, { at: path }); if (!ancestor) { return false; @@ -14,7 +12,7 @@ export function liftNodeWithSplit(editor: SlateEditor, [, path]: NodeEntry) { const [ancestorNode] = ancestor; - if (!Element.isElement(ancestorNode)) { + if (!isElement(ancestorNode)) { return false; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapImageNodeChild.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapImageNodeChild.ts index 56a00f7db..11be88de3 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapImageNodeChild.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapImageNodeChild.ts @@ -1,10 +1,9 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; +import type { SlateEditor, TNodeEntry } from '@udecode/plate-common'; import { isTextualNode } from '../queries'; import { unwrapNode } from './unwrapNode'; -export function unwrapImageNodeChild(editor: SlateEditor, entry: NodeEntry) { +export function unwrapImageNodeChild(editor: SlateEditor, entry: TNodeEntry) { return unwrapNode(editor, entry, ([node]) => isTextualNode(node)); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapNode.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapNode.ts index d24aa6ddc..e0d57f266 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapNode.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapNode.ts @@ -1,14 +1,12 @@ import { stubTrue } from '@technically/lodash'; -import type { SlateEditor } from '@udecode/plate-common'; -import { Element } from 'slate'; -import type { NodeEntry, Ancestor } from 'slate'; +import { getAboveNode, isElement, type SlateEditor, type TAncestor, type TNodeEntry } from '@udecode/plate-common'; export function unwrapNode( editor: SlateEditor, - [node, path]: NodeEntry, - match: (entry: NodeEntry, ancestor: NodeEntry) => boolean = stubTrue, + [node, path]: TNodeEntry, + match: (entry: TNodeEntry, ancestor: TNodeEntry) => boolean = stubTrue, ) { - const ancestor = editor.above({ at: path }); + const ancestor = getAboveNode(editor, { at: path }); if (!ancestor) { return false; @@ -16,7 +14,7 @@ export function unwrapNode( const [ancestorNode] = ancestor; - if (!Element.isElement(ancestorNode)) { + if (!isElement(ancestorNode)) { return false; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapSameTypeChild.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapSameTypeChild.ts index ceeea4631..1ffb703db 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapSameTypeChild.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapSameTypeChild.ts @@ -1,9 +1,7 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import { Element } from 'slate'; -import type { NodeEntry } from 'slate'; +import { getAboveNode, isElement, type SlateEditor, type TNodeEntry } from '@udecode/plate-common'; -export function unwrapSameTypeChild(editor: SlateEditor, [node, path]: NodeEntry) { - const ancestor = editor.above({ at: path }); +export function unwrapSameTypeChild(editor: SlateEditor, [node, path]: TNodeEntry) { + const ancestor = getAboveNode(editor, { at: path }); if (!ancestor) { return false; @@ -11,7 +9,7 @@ export function unwrapSameTypeChild(editor: SlateEditor, [node, path]: NodeEntry const [ancestorNode, ancestorPath] = ancestor; - if (!Element.isElement(ancestorNode)) { + if (!isElement(ancestorNode)) { return false; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapTableNodeChild.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapTableNodeChild.ts index a92010c4d..ebccfc060 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapTableNodeChild.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/unwrapTableNodeChild.ts @@ -5,17 +5,15 @@ import { isTableNode, isTableRowNode, } from '@prezly/slate-types'; -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; -import type { Node } from 'slate'; +import type { SlateEditor, TNode, TNodeEntry } from '@udecode/plate-common'; import { unwrapNode } from './unwrapNode'; -export function unwrapTableNodeChild(editor: SlateEditor, entry: NodeEntry) { +export function unwrapTableNodeChild(editor: SlateEditor, entry: TNodeEntry) { return unwrapNode(editor, entry, ([node]) => canUnwrapNode(node)); } -function canUnwrapNode(node: Node) { +function canUnwrapNode(node: TNode) { return ( isHeadingNode(node) || isQuoteNode(node) || diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/wrapSiblingTextNodesIntoParagraph.ts b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/wrapSiblingTextNodesIntoParagraph.ts index e330854a0..572f7c3fa 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/fixers/wrapSiblingTextNodesIntoParagraph.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/fixers/wrapSiblingTextNodesIntoParagraph.ts @@ -1,15 +1,16 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry, NodeMatch } from 'slate'; -import { Node, Path, Text } from 'slate'; +import type { TNodeEntry} from '@udecode/plate-common'; +import { getNodeChildren, isText, type SlateEditor } from '@udecode/plate-common'; +import type { NodeMatch , Node} from 'slate'; +import { Path } from 'slate'; export function wrapSiblingTextNodesIntoParagraph( editor: SlateEditor, - [node, path]: NodeEntry, + [node, path]: TNodeEntry, ): boolean { - if (!Text.isText(node)) return false; + if (!isText(node)) return false; if (path.length === 0) return false; - const combinePaths = [path, ...collectNextSiblingsWhileMatching(editor, path, Text.isText)]; + const combinePaths = [path, ...collectNextSiblingsWhileMatching(editor, path, isText)]; const from = combinePaths[0]; const to = combinePaths[combinePaths.length - 1]; @@ -40,8 +41,8 @@ function collectNextSiblingsWhileMatching( ): Path[] { if (current.length === 0) return []; - // @ts-expect-error TODO: Fix this - const siblingsAfter = Array.from(Node.children(editor, Path.parent(current))).filter( + const children = getNodeChildren(editor, Path.parent(current)); + const siblingsAfter = Array.from(children).filter( ([, path]) => Path.isAfter(path, current), ); diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/hierarchySchema.ts b/packages/slate-editor/src/modules/nodes-hierarchy/hierarchySchema.ts index b2ab3cbaf..9b88ba5a1 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/hierarchySchema.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/hierarchySchema.ts @@ -22,7 +22,7 @@ import { BookmarkNode, CalloutNode, } from '@prezly/slate-types'; -import { Text } from 'slate'; +import { isText } from '@udecode/plate-common'; import { EmbedNode } from '#extensions/embed'; @@ -85,7 +85,7 @@ export const hierarchySchema: NodesHierarchySchema = { [HTML_NODE_TYPE]: [allowChildren(isEmptyTextNode, fixers.liftNodeNoSplit)], [IMAGE_NODE_TYPE]: [ allowChildren( - Text.isText, + isText, combineFixers([ fixers.unwrapImageNodeChild, fixers.unwrapSameTypeChild, diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/allowChildren.ts b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/allowChildren.ts index 2216511d9..cbd7789eb 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/allowChildren.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/allowChildren.ts @@ -1,4 +1,4 @@ -import { Node } from 'slate'; +import { getNodeChildren } from '@udecode/plate-common'; import type { HierarchyFixer, HierarchyNormalizer, HierarchyNodeQuery } from '../types'; @@ -8,8 +8,8 @@ export function allowChildren( ): HierarchyNormalizer { return (editor, node, path) => { if ('children' in node) { - // @ts-expect-error TODO: FIx this - for (const [childNode, childPath] of Node.children(editor, path)) { + const children = getNodeChildren(editor, path); + for (const [childNode, childPath] of children) { if (!isAllowed(childNode, childPath, editor)) { return fix(editor, [childNode, childPath]); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/mustHaveChildren.ts b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/mustHaveChildren.ts index dbaf61901..3a4c8da08 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/mustHaveChildren.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/mustHaveChildren.ts @@ -1,9 +1,10 @@ +import { isEditor, isElement } from '@udecode/plate-common'; + import type { HierarchyFixer, HierarchyNormalizer } from '../types'; export function mustHaveChildren(fix: HierarchyFixer): HierarchyNormalizer { return (editor, node, path) => { - // @ts-expect-error TODO: Fix this - if ('children' in node && node.children.length === 0) { + if ((isEditor(node) || isElement(node)) && node.children.length === 0) { const at = [...path, 0]; return fix(editor, [node, at]); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/removeWhenNoChildren.ts b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/removeWhenNoChildren.ts index 87860080d..66b3f13ce 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/removeWhenNoChildren.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/normilizers/removeWhenNoChildren.ts @@ -1,9 +1,10 @@ +import { isEditor, isElement } from '@udecode/plate-common'; + import type { HierarchyNormalizer } from '../types'; export function removeWhenNoChildren(): HierarchyNormalizer { return (editor, node, path) => { - // @ts-expect-error TODO: Fix this - if ('children' in node && node.children.length === 0) { + if ((isEditor(node) || isElement(node)) && node.children.length === 0) { editor.removeNodes({ at: path, match: (n) => n === node }); return true; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedInTableCell.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedInTableCell.ts index 48b56f07a..922c12a33 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedInTableCell.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedInTableCell.ts @@ -1,6 +1,6 @@ import { isListNode, isParagraphNode } from '@prezly/slate-types'; -import type { Node } from 'slate'; +import type { TNode } from '@udecode/plate-common'; -export function isAllowedInTableCell(node: Node) { +export function isAllowedInTableCell(node: TNode) { return isParagraphNode(node) || isListNode(node); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedOnTopLevel.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedOnTopLevel.ts index 6a6e4e9f0..4deffabb0 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedOnTopLevel.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isAllowedOnTopLevel.ts @@ -17,13 +17,14 @@ import { isTableNode, VideoNode, } from '@prezly/slate-types'; +import type { TNode } from '@udecode/plate-common'; import type { Node } from 'slate'; import { ButtonBlockNode } from '#extensions/button-block'; import { EmbedNode } from '#extensions/embed'; import { PlaceholderNode } from '#extensions/placeholders'; -export function isAllowedOnTopLevel(node: Node) { +export function isAllowedOnTopLevel(node: Node | TNode) { return ( BookmarkNode.isBookmarkNode(node) || isAttachmentNode(node) || diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isDescendantOf.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isDescendantOf.ts index 93633e555..333ed52e7 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isDescendantOf.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isDescendantOf.ts @@ -1,8 +1,10 @@ +import { getLevels } from '@udecode/plate-common'; + import type { HierarchyNodeQuery } from '../types'; export function isDescendantOf(parentMatch: HierarchyNodeQuery): HierarchyNodeQuery { return (node, path, editor) => { - const levels = editor.levels({ + const levels = getLevels(editor, { at: path, match: (n) => n !== node, }); diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isEmptyTextNode.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isEmptyTextNode.ts index e948a226e..d4b657c32 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isEmptyTextNode.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isEmptyTextNode.ts @@ -1,6 +1,6 @@ -import { Text } from 'slate'; -import type { Node } from 'slate'; +import type { TNode } from '@udecode/plate-common'; +import { isText } from '@udecode/plate-common'; -export function isEmptyTextNode(node: Node) { - return Text.isText(node) && node.text === ''; +export function isEmptyTextNode(node: TNode) { + return isText(node) && node.text === ''; } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isInlineNode.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isInlineNode.ts index 3968d7901..38573e2b0 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isInlineNode.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isInlineNode.ts @@ -1,7 +1,6 @@ import { isLinkNode, isMentionNode, isVariableNode } from '@prezly/slate-types'; -import { Text } from 'slate'; -import type { Node } from 'slate'; +import { isText, type TNode } from '@udecode/plate-common'; -export function isInlineNode(node: Node) { - return Text.isText(node) || isLinkNode(node) || isMentionNode(node) || isVariableNode(node); +export function isInlineNode(node: TNode) { + return isText(node) || isLinkNode(node) || isMentionNode(node) || isVariableNode(node); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isTextualNode.ts b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isTextualNode.ts index 821851627..a9524df0e 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/queries/isTextualNode.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/queries/isTextualNode.ts @@ -1,8 +1,8 @@ import { isHeadingNode, isParagraphNode, isQuoteNode } from '@prezly/slate-types'; -import type { Node } from 'slate'; +import type { TNode } from '@udecode/plate-common'; import { isInlineNode } from './isInlineNode'; -export function isTextualNode(node: Node) { +export function isTextualNode(node: TNode) { return isInlineNode(node) || isParagraphNode(node) || isHeadingNode(node) || isQuoteNode(node); } diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/types.ts b/packages/slate-editor/src/modules/nodes-hierarchy/types.ts index 43530e0fe..6852c7c0b 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/types.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/types.ts @@ -1,9 +1,9 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { Path, NodeEntry, Node } from 'slate'; +import type { SlateEditor, TNode, TNodeEntry } from '@udecode/plate-common'; +import type { Path } from 'slate'; -export type HierarchyNodeQuery = (node: Node, path: Path, editor: SlateEditor) => boolean; -export type HierarchyNormalizer = (editor: SlateEditor, node: Node, path: Path) => boolean; -export type HierarchyFixer = (editor: SlateEditor, entry: NodeEntry) => boolean; +export type HierarchyNodeQuery = (node: TNode, path: Path, editor: SlateEditor) => boolean; +export type HierarchyNormalizer = (editor: SlateEditor, node: TNode, path: Path) => boolean; +export type HierarchyFixer = (editor: SlateEditor, entry: TNodeEntry) => boolean; export const EDITOR_NODE_TYPE = Symbol('EDITOR'); export const TEXT_NODE_TYPE = Symbol('TEXT'); diff --git a/packages/slate-editor/src/modules/nodes-hierarchy/withNodesHierarchy.ts b/packages/slate-editor/src/modules/nodes-hierarchy/withNodesHierarchy.ts index 597ed716b..b3ef0ae87 100644 --- a/packages/slate-editor/src/modules/nodes-hierarchy/withNodesHierarchy.ts +++ b/packages/slate-editor/src/modules/nodes-hierarchy/withNodesHierarchy.ts @@ -1,6 +1,5 @@ -import type { SlateEditor, TNode } from '@udecode/plate-common'; -import { Text } from 'slate'; -import { Editor } from 'slate'; +import type { TNode} from '@udecode/plate-common'; +import { isEditor, isElement, isText, type SlateEditor } from '@udecode/plate-common'; import { EDITOR_NODE_TYPE, TEXT_NODE_TYPE } from './types'; import type { NodesHierarchySchema, HierarchyNormalizer } from './types'; @@ -14,7 +13,6 @@ export function withNodesHierarchy(schema: NodesHierarchySchema) { const normalizers = getSchemaNormalizers(node, schema); for (const normalizer of normalizers) { - // @ts-expect-error TODO: Fix this const isNormalized = normalizer(editor, node, path); if (isNormalized) { @@ -32,12 +30,11 @@ export function withNodesHierarchy(schema: NodesHierarchySchema) { function getSchemaNormalizers(node: TNode, schema: NodesHierarchySchema) { let res: HierarchyNormalizer[] | undefined = undefined; - if (Text.isText(node)) { + if (isText(node)) { res = schema[TEXT_NODE_TYPE]; - } else if (Editor.isEditor(node)) { + } else if (isEditor(node)) { res = schema[EDITOR_NODE_TYPE]; - } else if ('type' in node) { - // @ts-expect-error TODO: Fix this + } else if (isElement(node)) { res = schema[node.type]; } diff --git a/packages/slate-lists/src/normalizations/normalizeListItemChildren.ts b/packages/slate-lists/src/normalizations/normalizeListItemChildren.ts index 6927cc324..104bf017e 100644 --- a/packages/slate-lists/src/normalizations/normalizeListItemChildren.ts +++ b/packages/slate-lists/src/normalizations/normalizeListItemChildren.ts @@ -1,6 +1,6 @@ -import type { SlateEditor } from '@udecode/plate-common'; +import { getNodeChildren, isText, type SlateEditor } from '@udecode/plate-common'; import type { NodeEntry } from 'slate'; -import { Node, Text } from 'slate'; +import type { Node } from 'slate'; import type { ListsSchema } from '../types'; @@ -17,11 +17,10 @@ export function normalizeListItemChildren( return false; } - const children = Array.from(Node.children(editor, path)); + const children = Array.from(getNodeChildren(editor, path)); for (const [childIndex, [childNode, childPath]] of children.entries()) { - // @ts-expect-error TODO: Fix this - if (Text.isText(childNode) || editor.isInline(childNode)) { + if (isText(childNode) || editor.isInline(childNode)) { const listItemText = schema.createListItemTextNode({ children: [childNode], }); diff --git a/packages/slate-lists/src/normalizations/normalizeListItemTextChildren.ts b/packages/slate-lists/src/normalizations/normalizeListItemTextChildren.ts index 99a4997bc..81d7d1b4c 100644 --- a/packages/slate-lists/src/normalizations/normalizeListItemTextChildren.ts +++ b/packages/slate-lists/src/normalizations/normalizeListItemTextChildren.ts @@ -1,6 +1,5 @@ -import type { SlateEditor } from '@udecode/plate-common'; -import type { NodeEntry } from 'slate'; -import { Element, Node } from 'slate'; +import { getNodeChildren, isElement, type SlateEditor } from '@udecode/plate-common'; +import type { NodeEntry , Node } from 'slate'; import type { ListsSchema } from '../types'; @@ -17,9 +16,9 @@ export function normalizeListItemTextChildren( return false; } - for (const [childNode, childPath] of Node.children(editor, path)) { - // @ts-expect-error TODO: Fix this - if (Element.isElement(childNode) && !editor.isInline(childNode)) { + const children = getNodeChildren(editor, path); + for (const [childNode, childPath] of children) { + if (isElement(childNode) && !editor.isInline(childNode)) { editor.unwrapNodes({ at: childPath }); return true; } diff --git a/packages/slate-tables/src/core/withTablesDeleteBehavior.ts b/packages/slate-tables/src/core/withTablesDeleteBehavior.ts index 96fe72131..98d7dce41 100644 --- a/packages/slate-tables/src/core/withTablesDeleteBehavior.ts +++ b/packages/slate-tables/src/core/withTablesDeleteBehavior.ts @@ -1,4 +1,3 @@ -import type { SlateEditor } from '@udecode/plate-common'; import type { Location } from 'slate'; import { Range, Point } from 'slate'; @@ -8,14 +7,12 @@ export function withTablesDeleteBehavior(editor: T): T { const { deleteBackward, deleteForward } = editor; editor.deleteBackward = (unit) => { - // @ts-expect-error TODO: Fix this if (canDeleteInTableCell(editor, editor.start)) { deleteBackward(unit); } }; editor.deleteForward = (unit) => { - // @ts-expect-error TODO: Fix this if (canDeleteInTableCell(editor, editor.end)) { deleteForward(unit); } @@ -26,7 +23,7 @@ export function withTablesDeleteBehavior(editor: T): T { function canDeleteInTableCell( editor: T, - getEdgePoint: (editor: SlateEditor, at: Location) => Point, + getEdgePoint: (at: Location) => Point, ) { if (editor.selection && Range.isCollapsed(editor.selection)) { const [cell] = editor.nodes({ @@ -35,7 +32,7 @@ function canDeleteInTableCell( if (cell) { const [, cellPath] = cell; - const edge = getEdgePoint(editor, cellPath); + const edge = getEdgePoint(cellPath); if (Point.equals(editor.selection.anchor, edge)) { return false; diff --git a/packages/slate-types/src/nodes/TableNode.ts b/packages/slate-types/src/nodes/TableNode.ts index d91d529d7..cecd7cbc0 100644 --- a/packages/slate-types/src/nodes/TableNode.ts +++ b/packages/slate-types/src/nodes/TableNode.ts @@ -1,3 +1,4 @@ +import type { TNode } from '@udecode/plate-common'; import type { Node } from 'slate'; import { type ElementNode, isElementNode } from './ElementNode'; @@ -26,14 +27,14 @@ export interface TableCellNode extends ElementNode { colspan?: number; } -export function isTableNode(value: Node): value is TableNode { +export function isTableNode(value: Node | TNode): value is TableNode { return isElementNode(value, TABLE_NODE_TYPE); } -export function isTableCellNode(value: Node): value is TableCellNode { +export function isTableCellNode(value: Node | TNode): value is TableCellNode { return isElementNode(value, TABLE_CELL_NODE_TYPE); } -export function isTableRowNode(value: Node): value is TableRowNode { +export function isTableRowNode(value: Node | TNode): value is TableRowNode { return isElementNode(value, TABLE_ROW_NODE_TYPE); } diff --git a/packages/slate-types/src/nodes/validation/isObject.ts b/packages/slate-types/src/nodes/validation/isObject.ts index 63054f645..09c08f05d 100644 --- a/packages/slate-types/src/nodes/validation/isObject.ts +++ b/packages/slate-types/src/nodes/validation/isObject.ts @@ -1,4 +1,3 @@ -// @ts-expect-error TODO: Fix this import { isPlainObject } from 'is-plain-object'; export function isObject(value: unknown): value is Record { diff --git a/packages/slate-types/tsconfig.build.json b/packages/slate-types/tsconfig.build.json index a42d924f4..a3866ad89 100644 --- a/packages/slate-types/tsconfig.build.json +++ b/packages/slate-types/tsconfig.build.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig.build.json", "compilerOptions": { "rootDir": "./src", - "declarationDir": "./build" + "declarationDir": "./build", + "moduleResolution": "node" }, "include": ["./src"], } diff --git a/packages/slate-types/tsconfig.json b/packages/slate-types/tsconfig.json index ccf6ebb58..298bfd131 100644 --- a/packages/slate-types/tsconfig.json +++ b/packages/slate-types/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "moduleResolution": "node", "rootDir": "./src" }, "include": ["./src"],