Skip to content

Issues upgrading unist-util-visit, remark, and remark-html #192

Answered by ChristianMurphy
kentcdodds asked this question in Q&A
Discussion options

You must be logged in to vote

Howdy!
In one of the recent type update was to allow for more narrow definition and stricter validation on nodes.
For example being able to better differentiate between a HAST or and MDAST node.
In general this makes code safer and easier to work with, it does require some migration.

For plugins the generic on the Plugin type can be used to define what types of node(s) it accepts.
For example it could accept mdast Root https://github.com/remarkjs/remark-validate-links/blob/5a2641a0f24049429f4ce0132e839fb1ec24ad18/lib/index.js#L54

Or if the code is being used outside a plugin context, the type can be narrowed with the techniques outlined in https://unifiedjs.com/learn/recipe/narrow-node-ty…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@kentcdodds
Comment options

Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
5 replies
@kentcdodds
Comment options

@wooorm
Comment options

@wooorm
Comment options

@kentcdodds
Comment options

@wooorm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants