A tool to convert JavaScript to TypeScript using Claude AI through Anthropic Bedrock
Project description
JavaScript/TypeScript Converter SDK
A powerful Python library for converting code between JavaScript and TypeScript using Claude AI through Anthropic Bedrock.
Features
- Code Conversion: Convert JavaScript code to TypeScript with proper type annotations
- Unit Test Generation: Generate comprehensive unit tests for TypeScript code
- AWS Bedrock Integration: Uses Anthropic's Claude AI through AWS Bedrock for intelligent code conversion
- Configurable Options: Flexible configuration for different conversion scenarios
Installation
pip install jstsconverter
Quick Start
from jstsconverter import JSConverter
# Initialize the converter
converter = JSConverter(
aws_access_key="your-aws-access-key",
aws_secret_key="your-aws-secret-key",
aws_region="us-east-1"
)
# Convert JavaScript to TypeScript
js_code = """
function greet(name) {
return "Hello, " + name + "!";
}
"""
typescript_code = converter.convert_js_to_ts(js_code)
print(typescript_code)
Configuration
The converter can be configured with AWS credentials in several ways:
- Direct initialization:
converter = JSConverter(
aws_access_key="your-key",
aws_secret_key="your-secret",
aws_region="us-east-1"
)
- Environment variables:
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_DEFAULT_REGION=us-east-1
.envfile:
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=us-east-1
Requirements
- Python 3.7+
- AWS account with Anthropic Bedrock access
- Valid AWS credentials
Dependencies
anthropic: For Claude AI integrationpython-dotenv: For environment variable management
License
MIT License
Author
Ramya Paranitharan (ramya.paranitharan@optisolbusiness.com)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jstsconverter-0.1.1.tar.gz.
File metadata
- Download URL: jstsconverter-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5add8ebf12e245502ab7804e58575ae607fe4e7c6f86a4486c2735a749181b
|
|
| MD5 |
938d2e9a45f27cb88e891d03853f8ad4
|
|
| BLAKE2b-256 |
151205b37ef4ffb2ffee2e4f73d6f511311d8d87b40effa8f253b42d339732fd
|
File details
Details for the file jstsconverter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: jstsconverter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3a74c403e7016345f9c5ceaf98e7e78b1e6c5c7a968b17fcbf1510edbf0b4eb
|
|
| MD5 |
396e6ad5b7f6c4ac53148ac187dc04b7
|
|
| BLAKE2b-256 |
eb01fa4135e16a8223184be9d5486be6554709492852fba56e1d62f181e5b946
|