[Bug]: Using this editor in typescript, the chain method cannot be found #4026
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Triage: Open
A new issue or pullrequest that requires triage (added by default)
Type: Bug
The issue or pullrequest is related to a bug
Which packages did you experience the bug in?
tiptap vue3 typescript
What Tiptap version are you using?
2
What’s the bug you are facing?
I am using this editor in typescript, the following initialization code exists in component A to create editor object:
`import { useEditor, EditorContent } from '@tiptap/vue-3';
import StarterKit from '@tiptap/starter-kit';
const editor = useEditor({
content:
测试文本
,extensions: [StarterKit]
});`
I then transfer this editor object to another component, defined in another component as follows:
const props = defineProps<{ editor: any }>();
I tried many types to constrain and finally chose any , but the problem still exists.
I tried calling the props.editor.chain().focus().toggleBold().run() method, but the browser gave an error: [Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'chain ')].
I only have this problem in typescript
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
I think it can be used normally in typescript.
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: