-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Support Node
typeParam in Pluggable
and PluggableList
#221
Comments
Sure, probably good to do? Don’t see big downsides?
|
Improvements are welcome! I'd also note that it would be even more ideal, if we could make the AST type for plugins variadic. There was some exploration of this in: |
Would that mean sort of similar to how a processor has an InputTree, CurrentTree, OutputResult? So like, PluggableList would have InputTree and OutputTree, where Aside indeed: this might run into TS limitations. If we’re going to do something, I’d prefer moving to JSDoc if that’s now possible (and/or maybe clean the JS API a bit if that makes that possible?) over doing more and more complex types |
Exactly
👍 |
I think this is still not possible indeed due to TypeScript limitations. Still, it would be useful for MDX plugin arrays, where the AST type isn’t supposed to change. Alternatively the MDX plugin types could be changed to |
That alternative seems pretty nice (though: presets?). Why not do that? |
It may be possible for a limited number of plugins:
This could also work |
Presets and nested plugin lists could also exist there btw. |
After once again spending days trying to improve the types somewhat, I’d say: try it out, but I don’t have high hopes. It’s just all quite complex... |
Closing as I have strong doubts this issue is currently actionable, due to TS limitations around complex types. Improvements to types are of course welcome. |
Initial checklist
Problem
Currently the type of the AST is
any
in thePluggable
andPluggableList
types. I think it would be nice if they can be specified explicitly, and default unistNode
.For example, this is a nice to have
Solution
In https://github.com/unifiedjs/unified/blob/main/index.d.ts#L592-L606:
Alternatives
Keep it as-is.
The text was updated successfully, but these errors were encountered: