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

1.0.3 • Public • Published

ts-simple-interpreter

🚀 Quick start

  1. Install the package to your project
    npm install ts-simple-interpreter 
  2. Import the executeTS method to js/ts component
    import { executeTS } from 'ts-simple-interpreter'
    The return value will be the output of the executed result, similar to the output you would see in the console:
    const result = executeTS('your TypeScript code here');
    console.log(result); // This will log the output of the executed code

Example Usage

Here’s a simple example demonstrating how to use the executeTS method:

import { executeTS } from 'ts-simple-interpreter';

const tsCode = `
    const add = (a: number, b: number): number => {
        return a + b;
    };
    add(2, 3);
`;

const result = executeTS(tsCode);
console.log(result); // Expected output: 5

Package Sidebar

Install

npm i ts-simple-interpreter

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • tsctw