[Fix Issue #691] Add TypeScript Support and Load MDX Routes #958
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Fix Issue #691] Add TypeScript Support and Load MDX Routes
Description
Hello maintainers,
This pull request addresses and fixes Issue ##691, where we were required to add TypeScript support to the
loadMdx.server.js
file and enhance its functionality to load MDX routes recursively in a Remix app. Here are the changes made in this PR:Changes Made
TypeScript Conversion: Converted
loadMdx.server.js
to TypeScript and added type definitions for better code safety.Enhanced MDX Loading: Updated the code to load MDX files in a directory and generate a nested array of route attributes.
Improved Comments and Documentation: Enhanced comments and documentation to provide better understanding of the code.
Unit Tests: Implemented tests for
loadMdxDirectory
andloadMdxRouteFileAttributes
functions to ensure correct functionality.Motivation
The motivation behind these changes is to improve code maintainability and add support for TypeScript, which enhances the development experience by providing type checking and better code suggestions.
Testing
The code changes have been thoroughly tested locally to verify their correctness. Unit tests have been added to ensure the proper functioning of the functions.
How to Test
To test the changes locally, you can follow these steps:
Clone this PR branch from my forked repository.
Run the necessary setup and build commands.
Execute the test suite using
npm test
oryarn test
.Request for Review
This PR is based on the latest changes from the upstream repository and is now ready for review and merging into the main branch.
Please take the time to review the changes and provide any feedback or suggestions. I am more than willing to make any necessary adjustments to ensure the quality and compatibility of the code.
Thank you for maintaining this amazing open-source project, and I look forward to contributing further!
Best regards,
MMW