# ts-eval

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

Latest version **1.0.5** (published 2019-10-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install ts-eval
pnpm add ts-eval
yarn add ts-eval
bun add ts-eval
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2019-10-17 |
| First published | 2017-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | bluelovers |
| Keywords | eval, transpile, ts, typescript, vm |

## Links

- npm: https://www.npmjs.com/package/ts-eval
- Repository: https://github.com/bluelovers/ts-eval
- Homepage: https://github.com/bluelovers/ts-eval#readme
- Issues: https://github.com/bluelovers/ts-eval/issues
- npm.io page: https://npm.io/package/ts-eval

## Dependencies (6)

- [json5](https://npm.io/package/json5.md) ^2.1.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [find-up](https://npm.io/package/find-up.md) ^4.1.0
- [pkg-dir](https://npm.io/package/pkg-dir.md) ^4.2.0
- [@bluelovers/tsconfig](https://npm.io/package/@bluelovers/tsconfig.md) ^1.0.12
- [@ts-type/package-dts](https://npm.io/package/@ts-type/package-dts.md) ^1.0.4

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2019-10-17
- 1.0.4 — 2017-12-16
- 1.0.3 — 2017-12-16
- 1.0.2 — 2017-12-15
- 1.0.1 — 2017-12-14
- 1.0.0 — 2017-12-14

## README

# ts-eval

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

`npm i ts-eval`

### demo

```javascript
const tsEval = require("ts-eval");
import tsEval from 'ts-eval';
import { tsEval } from 'ts-eval';
import * as tsEval from 'ts-eval';
```

```javascript
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.
 */`)));
```

```javascript
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](index.ts)

```javascript
var context = 'outside';

let self = this;

(async () =>
{
	let r;

	console.log(r = await search_tsconfig('../vue-i18next'));

	var context = 'inside';

	this.context = 'inside 2';

	console.log(tseval(transpile(`context`), this));

})();
```

---
_Source: https://npm.io/package/ts-eval · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
