-
Notifications
You must be signed in to change notification settings - Fork 141
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
Feature request: TypeScript definition #18
Comments
Yes I do, vaguely. I'm be open to either as a contribution if you're interested! |
Sure, I'm happy to contribute. Let me know how you wanna go about it and I'll start from there. |
I think the plan would be either to convert the source to TS or write definition files. Whatever you prefer, I am open to either one. |
I'll work on this on Saturday. |
Hmmm, seems like mdx-js is working on TypeScript support on v2. We'll have better Options type once v2 is merged and upgrade the dependency accordingly in this repo. I may leave the type as |
Hey guys, first of all, thank you all for this package! However, I have found some issues after the rework, so I consider simply writing types for this module instead. If you are interested, I have published my forked version on npm for testing purposes. This package will be removed within 3 days following npm policy. TL;DR
Static page build size is huge after my reworkI am not too sure about the reason (if someone can help I will be more than appreciated), but this puts me off and sticks to the original npm package. TS version├ ● /blog/[slug] 2.02 MB 2.11 MB
├ ├ /blog/2020-10-07
├ └ /blog/2020-10-21 Original with types├ ● /blog/[slug] 2.86 kB 85.9 kB
├ ├ /blog/2020-10-07
├ └ /blog/2020-10-21 After verifying the network in both pages ( CaveatsSomehow as using module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.node = {
fs: "empty",
};
}
return config;
},
}; ConclusionStick to type declaration for me, and possibly supporting I guess it also relates to the way I use this module outside of |
@Howard86 wow, this is great - thanks for the thorough rundown! I would guess honestly that this is your reason for the large bundle size, maybe? In theory this shouldn't be an issue, but I don't know how the code transpiles through, and that seems like the only candidate. Regardless, I will probably take a serious look at rewriting this package in typescript at some point, but until then just having it ship with types I think would solve everyone's problems, and I'd be happy to accept a contribution to those ends. |
hmmm interesting... |
👋 If there's anything I can do to help move this issue forward, I'm happy to help. An update: There are versions of This might not be the right place to ask, but @jescalan, any thoughts or plans regarding support for v2 of Would it be helpful for me to investigate the build size issue that @Howard86 ran into above? That port of this package is no longer available (as noted, deleted after 3 days). Would it be useful for me to contribute an experimental port as a PR to a new branch on this repo? |
There's a PR here that adds types - if you could test it on your project(s) and give it a review that would be very helpful @aoberoi - I'm planning to ship it today. I am planning on supporting mdx version 2 as soon as i can after its release. It will be a major release to this package when it is supported. If anyone feels capable of completing a functional rewrite of this package in typescript, I would welcome this. So far there have been attempts but nobody has been able to get it across the line. I think shipping native typings should solve the problem for most though. |
@jescalan I started having a play around with the rewrite here: https://github.com/Ehesp/next-mdx-remote Some points:
My knowledge of the whole MDX ecosystem isn't great, but hopefully this helps. EDIT: Also worth adding, since MDX v2 exposes typings, there is a lot less faffing around with manual types. |
I just tried v2 but it seems the types are not exported. It means I cannot import the interfaces in my App and use them. 🤔 |
@raulfdm Did you have a chance to check out the readme? https://github.com/hashicorp/next-mdx-remote#typescript |
Hey @jescalan. I hadn't, I'm sorry. I had read the update from dependabot and thought it would have a default export via |
Closing as we now ship types! |
Do you have any plans to migrate to TypeScript?
Whether converting source code to TS or writing definition file, I can help on that so let me know 😉
The text was updated successfully, but these errors were encountered: