Inspiration

After delving into JavaScript last summer and subsequently learning about TypeScript this past summer, I recognized the complexity many developers face when transitioning between the two languages. This inspired me to create a JavaScript to TypeScript translator, aiming to streamline and simplify the process of learning a new programming language.

What it does

The translator automates the conversion process for entire JavaScript programs, including both vanilla JavaScript and React code, into TypeScript. Generative AI allows the translator to make accurate translations within seconds.

How we built it

The translator leverages a tuned Gemini 1.0 Pro model for predictions. To preprocess JavaScript files and their translated counterparts, I developed helper scripts that collect matching pairs of JavaScript and TypeScript files and organizes them into a suitable form for tuning. The files were sourced from the repo for a different project of mine and translated by hand to ensure accuracy.

Challenges we ran into

Working with generative AI for the first time was fun but challenging. Before I got deep into development, I needed to manage properly authenticating with OAuth2.0 including enabling the correct scopes. Additionally, I trained the model with a small dataset that was still time consuming to create.

Accomplishments that we're proud of

Creating a comprehensive and functional tool like the translator stands as a significant achievement. Despite juggling the demands of school, job searches, and other projects, I successfully navigated through burnout to deliver a solution that I plan on using in the future.

What we learned

Developing the translator provided valuable insights into LLM concepts, particularly in content generation methods. Through experimentation, I gained a deeper understanding of I can apply generative AI to otherwise time consuming development tasks.

What's next for JavaScript to TypeScript Translator

Current plans for the translator include automating data creation and strengthening the model's fine-tuning. Since I wrote the source files, the model will inevitably be biased toward my coding style. Additionally, I plan to expand the translator to cover more input and output languages to help programmers learn about the intricacies of new languages.

Share this project:

Updates