Port DataLoader to TypeScript
This PR migrates the entire codebase from JavaScript/Flow to TypeScript, modernizing the stack and improving type safety, tooling, and maintainability.
✅ Changes Included
- Migrated all source and test files from .js to .ts
- Removed Flow types and replaced them with TypeScript equivalents
- Added tsconfig.json with strict compiler options
- Switched build system from Babel to typescript and node type stripping
- Support ESM
- Refactored tests to TypeScript with proper type annotations
- Updated package.json scripts and dependencies
- Upgrade Eslint config
- Removed obsolete files
- switch to
npm
📈 Benefits This migration lays the foundation for better maintainability, improved tooling support, and enhanced type safety.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: NShahri / name: Nima Shahri (05c662ae5de37e0b6fc195ad72c3fd45175d8ab7, 1308818e951ae49e84dd30497f9cea5a9307c0fb, 509a35194999f39257cba52568ecc97791feb02d, 523fde1066f6f8e04fdaea3848914c1857b76e4f, 6374f4afa0b7e5fef6d0622846480903ac1f2c67, 910c937b7af659f67fd1d4c1802212e5f09a14f0, 9f967225c2c2ffd608d659809751946511c0faa5, a454ec2b21eaf100caaed02284e51ecb44bb0f91, b0814f924868b883f808ed507925f0b92b610c2a, b73bb0b3e4141f2b1530abb4a73cfc3d5446cedd, da5bfb89300be4bad76ef25c5b3e18a309c405df, ed9862adaad9cc874c60b73cfcde007aa9c1b99c, fab2884b2de1aa2355fd589d6470e3a631036f83, faf3fb08dc6329045d75c92e93fb47db29f4a542, 028d3c9851069cb8f38f528a01335ab070f646cf, 6da3bbbaf647de1d6efbb6e8ff61158262f6698b, 9fc234f60e061f16455e42f271de145b1af9d308, ca45b68aef337e5283489209a10739fe2f9fd896)
Hello, @leebyron @saihaj @graphql/dataloader-maintainers. This PR completes a full migration to TypeScript and includes several improvements to the build and test setup. I'd appreciate your review and any suggestions you might have. Thank you!
Thanks @ardatan — I’ve fixed the CI issue. Could you please try re-running the workflow when you get a chance?
@NShahri Still failing :/
tsup -> tsdown(https://tsdown.dev/) I definitely recommend using this.
Wouldn’t it be better to use Node’s type stripping for development, tsc for build, and leave the bundling up to the consumer?
The reason for the transition. The ecosystem is currently gathered in tsdown.
I’m not sure we need to add tsup or tsdown as dependencies. More dependencies, more dependabot alerts 😅
Thanks @benjie @productdevbook Switched to using Node’s type stripping for development and tsc for the build step.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 100.00%. Comparing base (a107730) to head (9f96722).
Additional details and impacted files
@@ Coverage Diff @@
## main #385 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 164 167 +3
Branches 52 55 +3
=========================================
+ Hits 164 167 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.