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

Type error with mdast@6 #7

Closed
4 tasks done
Saul-Mirone opened this issue Jul 9, 2023 · 3 comments
Closed
4 tasks done

Type error with mdast@6 #7

Saul-Mirone opened this issue Jul 9, 2023 · 3 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@Saul-Mirone
Copy link

Initial checklist

Affected packages and versions

remark-inline-links@6.0.1

Link to runnable example

No response

Steps to reproduce

  1. Install latest remark and remark-inline-links.
  2. Use the remark-inline-links plugin.
  3. Run tsc and see the error.

Expected behavior

Node type error reported.

Actual behavior

Type 'Root' is not assignable to type 'Node<Data>'.
           Types of property 'data' are incompatible.
             Type 'import("/Users/mirone/Code/milkdown-repos/milkdown/node_modules/.pnpm/@types+unist@3.0.0/node_modules/@types/unist/index").Data | undefined' is not assignable to type 'import("/Users/mirone/Code/milkdown-repos/milkdown/node_modules/.pnpm/@types+unist@2.0.6/node_modules/@types/unist/index").Data | undefined'.

Runtime

Node v16

Package manager

pnpm

OS

macOS

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 9, 2023
@remcohaszing
Copy link
Member

This issue is caused by @types/mdast depending on @types/unist@*. Unfortunately DefinitelyTyped uses * dependency ranges. This issue exists now that we're in the process of updating all packages in the unified ecosystem.

You can solve the issue using npm resolutions or yarn overrides in package.json.

{
  // for npm
  "resolutions": {
    "@types/node": "2"
  },
  // for yarn
  "overrides": {
    "@types/node": "2"
  }
}

For pnpm there may be a similar solution, but I'm not sure what. Nite that this is a temporary workaround. The issue should resolve itself later.

@wooorm
Copy link
Member

wooorm commented Jul 9, 2023

Hey!

I don‘t think it’s that.

The issue is about mdast@6 (which does not exist, but presumably refers to @types/mdast@4).
That version does not work with this project. Or most projects.

The solution is to not yet use @types/mdast@4.

If you do use @types/mdast@3, and if that does fail on @types/unist, then the override solution provided by @remcohaszing does the trick. But please note that the code needed is:

{
  // for npm
  "resolutions": {
    "@types/unist": "2"
  },
  // for yarn
  "overrides": {
    "@types/unist": "2"
  }
}

Closing because all projects have these problems. And we’re in the process to update everything. It isn’t useful to track it in individual projects.

@wooorm wooorm closed this as completed Jul 9, 2023
@github-actions

This comment has been minimized.

@wooorm wooorm added the 👀 no/external This makes more sense somewhere else label Jul 9, 2023
@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 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