-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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]: TypeError/regression introduced in 2.10.1: All options can be undefined
#5859
Comments
Well that is a nifty package. I am torn here because the type change introduced by 2.10 actually can prevent you from accessing something that does not exist (leading to a runtime error), and then there is this which is just forcing users to do checks for something that theoretically is accurate (someone may forget to call |
What if export function mergeAttributes(...objects: (Record<string, any> | undefined)[]): Record<string, any> { Then the fix on our end would be trivial (just add optional chaining when accessing properties from But for other users there may be other cases where the type changes in 2.10 and 2.10.1 cause issues that I'm not aware of. |
I don't know that it really is easier. I've been trying to see if I can get a typing that works but it all very complicated with this pseudo inheritance. I think it is better to just revert both changes & leave the types alone. There will always be someone who complains about types |
This was released with 2.10.2 |
…osis#5860) * revert: "fix(core): update the typings to be that options and storage are partials on an extended config ueberdosis#5852 (ueberdosis#5854)" This reverts commit 87d63d8. * revert: "fix(core): update the typing of `addOptions`, `addStorage` to have an optional parent ueberdosis#5768 (ueberdosis#5770)" This reverts commit d2f366d.
Affected Packages
react, core, all extensions
Version(s)
2.10.1
Bug Description
Code that was previously working fine, now gives a TypeError when trying to access properties on
this.options
. These two examples were working fine in Tiptap 2.9, but now give errors:Example 1
Example 2
Browser Used
Chrome
Code Example URL
No response
Expected Behavior
For example 1, I would expect this to work. I'm not sure how this can be done without using a non-null assertion
this.options.HTMLAttributes!
or without writing extra logic that wasn't previously necessary.For example 2, I recognise that MyLink can be configured without passing in
myFunc
, so maybe the old code was wrong and there should always have been a nullish check such asthis.options?.myFunc()
. But shouldn't it be possible to provide mandatory options?Additional Context (Optional)
Introduced with release 2.10.1 with #5854.
Also, I understand that the
options
types may be more correct now, but these changes are breaking type changes and according to Renovatebot, which we are using in our project, the passing percentage for this update is quite low, indicating there have been breaking changes. I don't know if this specific type change is the breaking change for everyone, but it is for us. See the below screenshot that shows Renovatebot stats for some of the packages.Dependency Updates
The text was updated successfully, but these errors were encountered: