prismicio / prismic-types

Type definitions for Prismic content, models, and APIs
https://prismic.io/docs/technologies/javascript
Apache License 2.0
11 stars 4 forks source link

"field" attributes of the RichText breaking #53

Closed loick closed 1 year ago

loick commented 1 year ago

Versions

Context

Hi everyone, I've been trying to update the last version of prismic-types, but I came across an issue on the RichText as you can see on the screenshot below:

CleanShot 2022-11-29 at 10 55 39@2x

This error only appears when I try to update this library, so I guess this is related.

Here is the full report from Typescript:

Type '[] | [RTNode, ...RTNode[]]' is not assignable to type '[] | [RTNode, ...RTNode[]] | null | undefined'.
  Type '[RTNode, ...RTNode[]]' is not assignable to type '[] | [RTNode, ...RTNode[]] | null | undefined'.
    Type '[import("{my_nodemodules_path}/@prismicio/types/dist/index").RTNode, ...import("{my_nodemodules_path}/@prismicio/types/dist/index").RTNode[]]' is not assignable to type '[import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTNode, ...import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTNode[]]'.
      Type at position 0 in source is not compatible with type at position 0 in target.
        Type 'import("{my_nodemodules_path}/@prismicio/types/dist/index").RTNode' is not assignable to type 'import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTNode'.
          Type 'RTHeading1Node' is not assignable to type 'RTNode'.
            Type 'import("{my_nodemodules_path}/@prismicio/types/dist/index").RTHeading1Node' is not assignable to type 'import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTHeading1Node'.
              Types of property 'spans' are incompatible.
                Type 'import("{my_nodemodules_path}/@prismicio/types/dist/index").RTInlineNode[]' is not assignable to type 'import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTInlineNode[]'.
                  Type 'import("{my_nodemodules_path}/@prismicio/types/dist/index").RTInlineNode' is not assignable to type 'import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTInlineNode'.
                    Type 'RTLinkNode' is not assignable to type 'RTInlineNode'.
                      Type 'import("{my_nodemodules_path}/@prismicio/types/dist/index").RTLinkNode' is not assignable to type 'import("{my_nodemodules_path}}/@prismicio/types/dist/index").RTLinkNode'.
                        Types of property 'data' are incompatible.
                          Type 'FilledContentRelationshipField<string, string, unknown> | FilledLinkToWebField | FilledLinkToMediaField' is not assignable to type 'FilledContentRelationshipField<string, string, never> | FilledLinkToWebField | FilledLinkToMediaField'.
                            Type 'FilledContentRelationshipField<string, string, unknown>' is not assignable to type 'FilledContentRelationshipField<string, string, never> | FilledLinkToWebField | FilledLinkToMediaField'.
                              Type 'FilledContentRelationshipField<string, string, unknown>' is not assignable to type 'FilledContentRelationshipField<string, string, never>'.
                                Types of property 'data' are incompatible.
                                  Type 'unknown' is not assignable to type 'undefined'.

Any idea what I'm missing here? Thanks 🙏

github-actions[bot] commented 1 year ago

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request addressing it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team

loick commented 1 year ago

Is there any news on this?

lihbr commented 1 year ago

Hey there,

We're really sorry for falling behind our predicted maintenance schedule and leaving you without any answer so far.

We've heard from various TypeScript issues related to the RichText field's type recently. We think it's due to a version mismatch between types shipped by packages because we bundled some of them inconsistently.

We'll try to get that fixed next week, and we'll keep you posted.

Thanks for your understanding.

loick commented 1 year ago

Sure no pb, thanks @lihbr!

lihbr commented 1 year ago

Hey @loick, we made some updates to our kits targeting that, could you try updating your dependencies and trying again? Hopefully we got it :)

loick commented 1 year ago

It's working properly indeed, thanks for your help 🙏 Upgrading both the react & types package made it work:

The versions working together are:

"@prismicio/react": "2.5.1",
"@prismicio/types": "0.2.7",