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]: TextStyleOptions type error #3954

Open
1 of 2 tasks
craig-bowers opened this issue Apr 10, 2023 · 5 comments
Open
1 of 2 tasks

[Bug]: TextStyleOptions type error #3954

craig-bowers opened this issue Apr 10, 2023 · 5 comments
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

@craig-bowers
Copy link

craig-bowers commented Apr 10, 2023

Which packages did you experience the bug in?

extension-text-style

What Tiptap version are you using?

2.0.2

What’s the bug you are facing?

https://tiptap.dev/examples/default

After converting the default example linked above to a .tsx file I got this typescript error:
image

I was able to get rid of the error in two ways so far:

1. Adding the 'types' property to the TextStyleOptions interface in the text-style.d.ts file

image

For reference, here is the color.d.ts file
image

2. Extending TextStyleOptions and then using the "as" keyword

image
...
image

I also looked at this page https://tiptap.dev/guide/typescript but I thought it might be for more custom extensions.

Should I stick with my #2 implementation, or should the types property get added directly to the TextStyleOptions type in the text-style.d.ts file?

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

This is only a typescript issue. It works fine in vanilla jsx.

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. 💖
@craig-bowers craig-bowers 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 Apr 10, 2023
@svenadlung
Copy link
Member

@craig-bowers thx for reporting. You are right. Something seems to be messed up here since #3541. I'll talk with @bdbch in the next days how to address the issue and come back to you after.

@craig-bowers
Copy link
Author

No problem. Thanks for looking into it!

@nk11dev
Copy link

nk11dev commented May 25, 2023

Hi. I just started using TipTap in my project to see how it works, used code from demo examples and facing this type error too.

Are you planning to fix this? I think, the basic use of the plugin should not give such errors at the start, especially from examples code. It's the little things like that that make a great first impression.

@towfiqi
Copy link

towfiqi commented Jul 6, 2023

Any update?

@towfiqi
Copy link

towfiqi commented Jul 6, 2023

Ok, just checked the definition of TextStyleOptions and it looks like the types property has been renamed to HTMLAttributes.

Here is the definition:

 export interface TextStyleOptions {
    HTMLAttributes: Record<string, any>;
}

So, my understanding is it's not actually a bug. You just need to updated documentation.

@bdbch bdbch added this to Tiptap Aug 4, 2023
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Aug 4, 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
No open projects
Status: Triage open
Development

No branches or pull requests

5 participants