Open hichemfantar opened 1 month ago
👋 Thanks for opening your first issue here! 👋
If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
Hello @hichemfantar!
Brightcove and the Video.js collaborators are planning on doing just this!
We have struggled for years now to make a 14 year old plain JavaScript project with JSDoc comments play nicely with TypeScript... with very mixed results (obviously).
At a high level, it starts with a project we call VHS Next. This will rewrite our playback engine, VHS, in TypeScript. Following that, we will do the same with Video.js itself - along with some significant architectural changes as well. There will be an RFC for that, of course, as well, sometime in 2025.
Please feel free to engage with the RFC(s) as they come up and your collaboration would be welcome!
@misteroneill Thanks for letting me know about the project! It seems VHS Next is still very far in the future and I'm thinking something more short term. Wouldn't converting the existing codebase to TS make the transition to the new architecture much smoother and less error prone due to the advantages of TS?
Introduction
Video.js has been a widely used open-source project that provides a reliable and extensible HTML5 video player for the web. As the ecosystem around JavaScript continues to grow, the need for more robust tools that enhance code quality, scalability, and developer productivity becomes critical. TypeScript, a superset of JavaScript, offers static typing and advanced tooling that can significantly improve the Video.js codebase.
This proposal outlines the benefits, potential challenges, and steps required to adopt TypeScript in Video.js.
Benefits of Adopting TypeScript
Improved Code Quality and Maintenance:
Enhanced Developer Experience:
Scalability:
Better Ecosystem Integration:
Future-Proofing:
Potential Challenges
Initial Migration Effort:
Contributor Adaptation:
Plugin Ecosystem:
Build Configuration Complexity:
tsconfig.json
, type declarations). However, modern build systems like Webpack and Rollup have good TypeScript support, and tools like Babel can help ease the transition.Plan for Migration
The migration can be carried out incrementally to ensure minimal disruption to the existing codebase and the ecosystem.
Phase 1: Tooling Setup (this seems to be done already)
tsconfig.json
) in the Video.js project.Phase 2: Incremental Migration
Phase 3: Full Module Conversion
Phase 4: Ecosystem and Plugin Support
Phase 5: Final Cleanup and Documentation
Conclusion
Adopting TypeScript in Video.js will improve the maintainability, scalability, and reliability of the project. It will enhance developer productivity and contribute to the long-term health of the project by positioning it as a modern, forward-looking library. With a phased approach to migration, the transition can be handled smoothly, minimizing disruption while ensuring the community continues to benefit from the flexibility and extensibility of Video.js.
I believe that this move will help Video.js continue to be a top choice for developers building video experiences on the web.
Let me know if you would like to refine or add any specific details to this proposal!