Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Using this editor in typescript, the chain method cannot be found #4026

Closed
1 of 2 tasks
JanYork opened this issue May 8, 2023 · 0 comments
Closed
1 of 2 tasks
Assignees
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

Comments

@JanYork
Copy link

JanYork commented May 8, 2023

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?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@JanYork JanYork added 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 labels May 8, 2023
@JanYork JanYork closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants