ts-transformer

transform typescript code to javascript code synchronously

Usage no npm install needed!

<script type="module">
  import tsTransformer from 'https://cdn.skypack.dev/ts-transformer';
</script>

README

ts-transformer


transform typescript code to javascript code synchronously

usage

var transform = require('ts-transformer').transform;

var ret = transform(`
import React from 'react';
 class Z extends React {}
`,
  `${__dirname}/x.tsx`,
  {
    target: 'es6',
    jsx: 'preserve',
    moduleResolution: 'node',
    declaration: true,
    sourceMap: true,
    noExternalResolve: true,
  });

console.log('transformed result:');
console.log(ret);