It’s not exactly what you are asking for, but these are two REPLs for TypeScript code: ts-node (“TypeScript execution and REPL for Node.js”) Deno (loosely similar to Node.js, but all code is written in TypeScript) Answer from rauschma on reddit.com
🌐
GitHub
github.com › TypeStrong › ts-node
GitHub - TypeStrong/ts-node: TypeScript execution and REPL for node.js
# Execute a script as `node` + `tsc`. ts-node script.ts # Starts a TypeScript REPL. ts-node # Execute code with TypeScript. ts-node -e 'console.log("Hello, world!")' # Execute, and print, code with TypeScript. ts-node -p -e '"Hello, world!"' # Pipe scripts to execute with TypeScript.
Starred by 13.1K users
Forked by 543 users
Languages   TypeScript 73.5% | JavaScript 24.9%
🌐
TypeScript
typescriptlang.org › play
TypeScript: TS Playground - An online editor for exploring TypeScript and JavaScript
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
🌐
Reddit
reddit.com › r/typescript › looking for a ts repl/tinkering tool, any recommendations?
r/typescript on Reddit: Looking for a TS REPL/tinkering tool, any recommendations?
June 26, 2022 -

Im looking for something like this:

  • a standalone application where you can open a target project dir

  • type some TS in a code section

  • run it and see output in a result section

  • edit, rerun see new result etc...

Does something like this exist? It would need to take the code and pass it through something like `npx ts-node src/tinker.ts` and format output to something nice.

Maybe it could be VS code plugin. I just miss some "tinkering pad". I used to use this tool all the time: https://tinkerwell.app/ (PHP).

Any recommendations?

🌐
GitHub
github.com › HerringtonDarkholme › typescript-repl
GitHub - HerringtonDarkholme/typescript-repl: An upgraded TypeScript REPL
TSUN will find the closest tsconfig.json relative to your working directory. You can now compile TypeScript to ES6 in node6+!
Starred by 210 users
Forked by 16 users
Languages   TypeScript 99.8% | JavaScript 0.2%
🌐
Replit
replit.com › languages › typescript
TypeScript Online Compiler & Interpreter - Replit
Write and run TypeScript code using our TypeScript online compiler & interpreter. You can build, share, and host applications right from your browser!
🌐
Convex
convex.dev › typescript 101 › introduction to typescript › repl
REPL | TypeScript Guide by Convex
TypeScript REPL offers a hands-on way to write and test TypeScript code snippets immediately. This tool is invaluable for developers because it speeds up the development process by letting you test ideas and see results right away.
🌐
Js
repl.js.org
An Online REPL for JavaScript/TypeScript
We cannot provide a description for this page right now
Find elsewhere
Top answer
1 of 1
7

I found the solution, in fact there is need to configure the ts-node repl service properly in order for this to work.

First we need to import

  • repl from node packages
  • ts from typescript npm package
  • ts-node from package
import repl from "repl";
import ts from "typescript";
import * as tsnode from "ts-node";

then we need to create a ts-node repl service like this:

const replService: tsnode.ReplService = tsnode.createRepl();

now we can actually create a service thanks to the evalAwarePartialHost member that is's inside the replService that we just created:

const service = tsnode.create({ ...replService.evalAwarePartialHost });

we then set the ts member of the service to be ts that we imported:

service.ts = ts;

now we have to set the service in the ts-node repl:

replService.setService(service);

now it's time to create the actual repl server:

const replServer = repl.start({
  prompt: "$  ",
  ignoreUndefined: true,
  eval: replService.nodeEval,
});

the entire code looks like this:

import repl from "repl";
import ts from "typescript";
import * as tsnode from "ts-node";

// Create a ts-node replService
const replService: tsnode.ReplService = tsnode.createRepl();
const service = tsnode.create({ ...replService.evalAwarePartialHost });
service.ts = ts;
replService.setService(service);

// create a node-repl server
const replServer = repl.start({
  prompt: "$  ",
  ignoreUndefined: true,
  eval: replService.nodeEval,
});

// setup environment
replServer.setupHistory(".log", () => {});

hope this can be helpfull for someone else!!

=)

🌐
npm
npmjs.com › package › local-ts-repl
local-ts-repl - npm
Local node REPL for TypeScript projects. Run a REPL including the context of your project. Customize it to have global variables ready to use (DB connections, service calls, etc).
      » npm install local-ts-repl
    
Published   Jun 22, 2021
Version   0.1.3
Author   Javier López Pardo
🌐
Replit
replit.com › @replit › TypeScript
TypeScript - Replit
Typescript is a strict syntactical superset of JavaScript and adds optional static typing to the language.
🌐
TypeStrong
typestrong.org › ts-node
ts-node | ts-node
TypeScript execution and REPL for node.js
🌐
Today I Learned
til.hashrocket.com › posts › ie1jkaeibf-quickly-run-a-typescript-repl-in-your-terminal
Quickly run a typescript REPL in your terminal - Today I Learned
May 3, 2023 - TIL is an open-source project by Hashrocket that exists to catalogue the sharing & accumulation of knowledge as it happens day-to-day.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Node.js Exercises in Repl.it - Typescript or Javascript?
September 29, 2020 - I would sometimes encounter “spell errors” in the code, which indicates that the Repl.it code has type safety, but I’m under the impression that is it NOT Typescript. Is Node.js written in Typescript for Best Practice? Or, is the boilerplate Repl.it j...
🌐
GitHub
github.com › alex-dixon › vscode-typescript-repl
GitHub - alex-dixon/vscode-typescript-repl: Just evaluate TypeScript in your editor
This is a plugin for VSCode that provides an interactive programming experience for the TypeScript programming language. Debugging one function shouldn't require running the entire program.
Author   alex-dixon
🌐
Replit Docs
docs.replit.com › category › typescript
TypeScript
Replit is the fastest way to go from idea to app. Create and publish full-stack apps from your browser with AI at your fingertips—no installation or setup required.