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

Issue with typings with later versions of hast #750

Closed
4 tasks done
benjdlambert opened this issue Jul 11, 2023 · 3 comments
Closed
4 tasks done

Issue with typings with later versions of hast #750

benjdlambert opened this issue Jul 11, 2023 · 3 comments
Labels
📦 area/deps This affects dependencies 👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@benjdlambert
Copy link

benjdlambert commented Jul 11, 2023

Initial checklist

Affected packages and versions

react-markdown

Link to runnable example

No response

Steps to reproduce

Install react-markdown and run typescript with --skipLibCheck=false

Expected behavior

Types are happy and the library has 0 typescript errors

Actual behavior

node_modules/react-markdown/lib/rehype-filter.d.ts:2:43 - error TS2344: Type 'Root' does not satisfy the constraint 'void | Node<Data>'.
  Type 'Root' is not assignable to type 'Node<Data>'.
    Types of property 'data' are incompatible.
      Type 'import("/tmp/backstage-e2e-Ukrwaf/test-app/node_modules/@types/hast/node_modules/@types/unist/index").Data | undefined' is not assignable to type 'import("/tmp/backstage-e2e-Ukrwaf/test-app/node_modules/@types/unist/index").Data | undefined'.
        Type 'import("/tmp/backstage-e2e-Ukrwaf/test-app/node_modules/@types/hast/node_modules/@types/unist/index").Data' is not assignable to type 'import("/tmp/backstage-e2e-Ukrwaf/test-app/node_modules/@types/unist/index").Data'.
          Index signature for type 'string' is missing in type 'Data'.

2   this: import('unified').Processor<void, import('hast').Root, void, void>,
                                            ~~~~~~~~~~~~~~~~~~~

node_modules/react-markdown/lib/rehype-filter.d.ts:6:35 - error TS2344: Type 'Root' does not satisfy the constraint 'Node<Data>'.

6   | import('unified').Transformer<import('hast').Root, import('hast').Root>
                                    ~~~~~~~~~~~~~~~~~~~

Looks like there's some type incompatibility with later packages that have been released. This is blocking our pipeline and E2e tests for Backstage. We've had a suggestion that a potential fix is to bring in @types/unist@<3.0.0, maybe that needs implementing here or should we open an issue over there?

backstage/backstage#18643

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 11, 2023
@remcohaszing
Copy link
Member

This is an upstream issue that’s being worked on. See DefinitelyTyped/DefinitelyTyped#65789 (comment) for details and a workaround.

@remcohaszing remcohaszing closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2023
@github-actions

This comment has been minimized.

@remcohaszing remcohaszing added 📦 area/deps This affects dependencies 👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jul 11, 2023
@wooorm
Copy link
Member

wooorm commented Jul 11, 2023

External as Remco mentions, see DefinitelyTyped/DefinitelyTyped#66029.

@wooorm wooorm closed this as completed Jul 11, 2023
@wooorm wooorm added 👀 no/external This makes more sense somewhere else and removed 👀 no/external This makes more sense somewhere else labels Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 area/deps This affects dependencies 👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants