Skip to content

A tool to automatically convert JavaScript code to TypeScript using large language models (e.g., OpenAI's GPT-3).

License

Notifications You must be signed in to change notification settings

jeffskafi/js-to-ts-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-to-ts-converter

A tool to automatically convert JavaScript code to TypeScript using large language models (e.g., OpenAI's GPT-4).

Features

  • Convert JavaScript code to TypeScript
  • Leverages OpenAI's GPT-4 for accurate conversion
  • Command-Line Interface (CLI) for easy use
  • Automatically handles common TypeScript conversions and annotations

Installation

  1. Clone the repository:

    git clone https://github.com/jaafarskafi1/js-to-ts-converter.git
    cd js-to-ts-converter
  2. Install dependencies:

    npm install
  3. Set up OpenAI API key:

    • Sign up for the OpenAI API and get your API key.
    • Create a .env file in the root directory and add your API key:
      OPENAI_API_KEY=your_openai_api_key_here

Usage

  1. Run the converter:

    node src/index.js convert path/to/your/javascript-file.js
  2. The converted TypeScript file will be created in a new directory with a .ts extension.

Example

Convert a directory's js files:

node src/index.js convert your_directory_name

About

A tool to automatically convert JavaScript code to TypeScript using large language models (e.g., OpenAI's GPT-3).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published