Argument of type 'Root' is not assignable to parameter of type 'Node<Data>' #129
-
Hi there 👋 I have been updating my dependencies and now Given the following: import { Image, Root } from 'mdast';
import { visit } from 'unist-util-visit';
export function inlineImages() {
return async (tree: Root) => {
const nodes: Image[] = [];
visit(tree, 'image', (node) => {
nodes.push(node);
});
// ...
};
} It seems I'm now not allowed to pass a However I'm unsure how to type the suggested Any help greatly appreciated 😎 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @dmca-glasgow 👋 https://stackblitz.com/edit/github-4yca6z?file=src%2Fmain.ts |
Beta Was this translation helpful? Give feedback.
Hey @dmca-glasgow 👋
That error looks a lot like you may be mixing major versions of
unist-util-visit
and@types/mdast
.Make sure are both on the latest major version, at the time of writing these are
@types/mdast
v4 andunist-util-visit
v5.https://stackblitz.com/edit/github-4yca6z?file=src%2Fmain.ts