JavaScript

Transform TypeScript registry items into JavaScript before adding them to your project.

The @jsrepo/transform-javascript package is a transform plugin for jsrepo that converts TypeScript registry items into JavaScript before adding them to your project.

This only works for erasable syntax.

Installation

jsrepo config transform javascript
# or initialize any jsrepo project with the --js flag
jsrepo init @ieedan/std --js

This will automatically install the transform and add it to your config:

import { defineConfig } from "jsrepo";
import javascript from "@jsrepo/transform-javascript"; 

export default defineConfig({
	// ...
	transforms: [javascript()], 
});

This plugin will then transform any registry items written in TypeScript into JavaScript before adding them to your project.

Before:

math/add.ts
export function add(a: number, b: number): number {
	return a + b;
}

After:

math/add.js
export function add(a: number, b: number): number { 
export function add(a, b) { 
	return a + b;
}

Supported Languages

If your language of choice is not supported here feel free to contribute it!

  • ✅ Full support
  • ⚠️ Partial support
  • ❌ No support
LanguageSupport
TypeScript
Svelte