Closed mike-mcdonald closed 3 years ago
Sweet, thanks for working on this!
I think it would be better to solve it in the argument list: MDXContent(props = {})
.
Reasoning is that it’s documented that props
is an object in one example of the readme: https://github.com/wooorm/xdm#mdx-content.
Also, could you update the example in the readme following “The actual output of running node example.js is:”?
There are also two errors in the tests on CI. the babel one looks a bit flakey (I’ll check if that’s still the case), but the error message might need to be changed?
ps. run npm test
locally to test your changes! And you can use ASTExplorer to figure out what the AST is for certain JS code
Rebasing your PR against main should solve the weird babel error
The other error was related due to a change in Node 16.9. Updates the tests to fix that as well.
@wooorm Sounds like a plan. I'll adjust the fix to provide a default value for the props parameter and work on the test errors.
@wooorm I've updated my branch with your changes to main and am able to run npm run test
locally with no failures now!
Thanks, released!
Adjusts MDXContent function output to allow undefined props as a parameter without throwing a TypeError.
Closes #82