Fix using remark in typescript directly#513
Fix using remark in typescript directly#513wooorm merged 2 commits intoremarkjs:mainfrom remcohaszing:fix-remark-export-type
Conversation
ChristianMurphy
left a comment
There was a problem hiding this comment.
This works for direct calls to .parse and .stringify 👍
One consideration:
import remark = require("remark")
remark.use()would be marked as valid in this typing, but results in:
Error: Cannot invoke `use` on a frozen processor.
Create a new processor first, by invoking it: use `processor()` instead of `processor`.
|
Perhaps we should create a new type in
|
|
That could work 👍 /cc @Rokt33r who implemented much of |
|
/cc @remcohaszing FrozenProcessor now released in unified. Does that mean you can now update this PR based on that? |
Remark exports a unified processor, not a function that returns a processor. Unified processors also happen to be functions returning a new processor.
This requires a minimum unified version of 9.1.0.
|
Updated to use |
ChristianMurphy
left a comment
There was a problem hiding this comment.
LGTM, thanks @remcohaszing! 🙇
@ChristianMurphy I think it looks good for now. Sorry for my late answer |
Remark exports a unified processor, not a function that returns a processor. Unified processors also happen to be functions returning a new processor, meaning the old type worked for most situations, but not all.