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

Changes of types for RichTextNodeType breaks other PrismicIO library #19

Closed
chougron opened this issue Nov 29, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@chougron
Copy link

Versions

  • @prismicio/types: v0.1.18
  • node: v10.16.0

Reproduction

With the change in 0.1.18 of the RichTextNodeType type from an enum to a const variable, the import and export in @prismicio/richtext is not working anymore.

If you have @prismicio/richtext with version 2.0.0-beta.1, and your version of @prismicio/types is 0.1.18, you will have an issue with your types (especially if you try to compile).

Additional Details

Here is the interesting part of my package-lock.json :

"@prismicio/client": {
      "version": "6.0.0-beta.3",
      "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-6.0.0-beta.3.tgz",
      "integrity": "sha512-AZn0u5Ah6q4PGAlGvKyVSv3OfAbM1DjGpbZWedkMiBGJ6t/tB5GyaIh2Znsfdkw8QuL80041yURdsGXaQeE2HQ==",
      "requires": {
        "@prismicio/helpers": "^2.0.0-beta.0",
        "@prismicio/types": "^0.1.15"
      }
    },
    "@prismicio/helpers": {
      "version": "2.0.0-beta.3",
      "resolved": "https://registry.npmjs.org/@prismicio/helpers/-/helpers-2.0.0-beta.3.tgz",
      "integrity": "sha512-YaMRZ6JBb9f/+BXWq9V+xSQGOnWK3+8ebKi9GSeOjit+JOEZDSBn0hE87j6X7wp8cG5KTqXyBXsmd2vOh8IhdA==",
      "requires": {
        "@prismicio/richtext": "^2.0.0-beta.1",
        "@prismicio/types": "^0.1.17",
        "escape-html": "^1.0.3"
      }
    },
    "@prismicio/richtext": {
      "version": "2.0.0-beta.1",
      "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.0.0-beta.1.tgz",
      "integrity": "sha512-9LA+dcEtncprfjpPdQWsRThuFpDA0ID1Ne0yJJHVlKKl9qUDDfV7fbN714W2dxEV2zWRip/lyLlnfMOAABjE/w==",
      "requires": {
        "@prismicio/types": "^0.1.15"
      }
    },
    "@prismicio/types": {
      "version": "0.1.18",
      "resolved": "https://registry.npmjs.org/@prismicio/types/-/types-0.1.18.tgz"
    },

Steps to reproduce

I try to compile my code with the following command :
npx tsc --outDir dist
And I get the following error :

node_modules/@prismicio/richtext/dist/index.d.ts:10:62 - error TS2749: 'RichTextNodeType' refers to a value, but is being used as a type here. Did you mean 'typeof RichTextNodeType'?

10 declare type RichTextFunctionSerializer<ReturnType> = (type: RichTextNodeType, node: RTAnyNode, text: string | undefined, children: ReturnType[], key: string) => ReturnType | null | undefined;
                                                                ~~~~~~~~~~~~~~~~

node_modules/@prismicio/richtext/dist/index.d.ts:59:11 - error TS2749: 'RichTextNodeType' refers to a value, but is being used as a type here. Did you mean 'typeof RichTextNodeType'?

59     type: RichTextNodeType;
             ~~~~~~~~~~~~~~~~

What is expected?

The compilation should work as intended

What is actually happening?

With the change in 0.1.18 of the RichTextNodeType type from an enum to a const variable, the import and export in @prismicio/richtext is not working anymore.

@chougron chougron added the bug Something isn't working label Nov 29, 2021
@angeloashmore angeloashmore self-assigned this Nov 29, 2021
@angeloashmore
Copy link
Member

angeloashmore commented Nov 29, 2021

Hi @chougron, thanks for the report! This has been fixed in @prismicio/richtext@v2.0.0-beta.2

You should be able to run npm update @prismicio/richtext to update to the fixed version.

In case you are curious why the change was made to RichTextNodeType, here is the relevant issue: #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants