Skip to content

Type of parts of the AST in Typescript unclear #51

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

You must be logged in to vote

@lkj4 this incompatibility is likely coming from

https://github.com/mrzmmr/unist-util-find-all-between/blob/adb9565a4424bcd9bcd3db4199b4d15ba91c6ecb/types/index.d.ts#L16-L21

remark-* plugins expect to get mdast nodes, this is returning a list more generic unist Node, which doesn't have the properties generally expected on mdast.


a few options:
1, open an issue (or even better a PR) with https://github.com/mrzmmr/unist-util-find-all-between to add generics and type narrowing so it can figure out the type it is passed.
2. share a sample of the code you are trying, so folks can offer more concrete suggestions on what to do

In the meantime, you may want to checkout https://unifiedjs.com/lear…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@ChristianMurphy
Comment options

@lkj4
Comment options

@ChristianMurphy
Comment options

Comment options

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

Comment options

You must be logged in to vote
2 replies
@ChristianMurphy
Comment options

@lkj4
Comment options

Comment options

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

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