Version incompatibility in @prosemirror-adapter/svelte vs SvelteKit
radio-miskovice opened this issue · 5 comments
When using the code in examples/svelte
I get error in this code (Editor.svelte, lines 32, 27, etc.):
// line 29:
function editor(element: HTMLElement) {
editorView = createEditorView(element, {
paragraph: nodeViewFactory({
component: Paragraph,
as: 'div',
contentAs: 'p'
}),
heading: nodeViewFactory({
component: Heading
})
}, [
new Plugin({
view: pluginViewFactory({
component: Size
})
}),
...
The error reads:
Type 'typeof Paragraph__SvelteComponent_' is not assignable to type 'SvelteNodeViewComponent'.
Types of parameters 'options' and 'options' are incompatible.
Type 'ComponentConstructorOptions' is not assignable to type 'ComponentConstructorOptions<Record<string, never>>'.
Type 'EmptyProps' is not assignable to type 'Record<string, never>'.
Index signature for type 'string' is missing in type 'EmptyProps'.ts(2322)
Not sure how exactly approach a fix... My guess is that changing type in the adapter code should suffice, but did not have the courage to look inside, yet.
"@sveltejs/kit": "^1.5.0",
"@sveltejs/adapter-auto": "^2.0.0",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"@prosemirror-adapter/svelte": "^0.2.4",
Does it help if you update svelte to 3.57.0?
Unfortunately it doesn't.
export const createEditorView = (element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
...
It seems that nodeViews
' type should be different, but so far I have little idea 1. what exactly should be the change, 2. if there are any potential adverse effects of such a change.
Can you provide a stackblitz or codesandbox link? I still cannot reproduce.
I will check what is definition of ComponentConstructorOptions. If it is based on Record<> then it could be some option in typescript config. Stackblitz or Codesandbox later.
Have you managed to solve it? @radio-miskovice