ts-eval
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

ts-eval

eval(transpile(tscode)) function evaluates TypeScript code.

npm i ts-eval

demo

const tsEval = require("ts-eval");
import tsEval from 'ts-eval';
import { tsEval } from 'ts-eval';
import * as tsEval from 'ts-eval';
console.log(eval(tsEval.transpileEval(`/**
 * Created by user on 2017/12/14/014.
 */
import * as path from 'path';path;/**
 * Created by user on 2017/12/14/014.
 */`)));
console.log(tsEval.evalSandbox(`/**
 * Created by user on 2017/12/14/014.
 */
import * as path from 'path';path;/**
 * Created by user on 2017/12/14/014.
 */`));

fail note

i can't make this work see index.ts

var context = 'outside';
 
let self = this;
 
(async () =>
{
    let r;
 
    console.log(= await search_tsconfig('../vue-i18next'));
 
    var context = 'inside';
 
    this.context = 'inside 2';
 
    console.log(tseval(transpile(`context`), this));
 
})();

/ts-eval/

    Package Sidebar

    Install

    npm i ts-eval

    Weekly Downloads

    3

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    16 kB

    Total Files

    4

    Last publish

    Collaborators

    • bluelovers