malerba118 / react-sandbox-editor

React component library for sandboxed execution of html/js/css
https://malerba118.github.io/react-sandbox-editor/#/demo
36 stars 7 forks source link

Add typescript support #8

Open malerba118 opened 5 years ago

malerba118 commented 5 years ago

Something along the lines of

import * as ts from "typescript";

const source = "let x: string = 'string'";

let result = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS } });

window.alert(JSON.stringify(result));

Might want to make this a peer dependency/plugin option to reduce bundle size