Options
All
  • Public
  • Public/Protected
  • All
Menu

ts-node

Index

Type aliases

EvalAwarePartialHost

EvalAwarePartialHost: Pick<CreateOptions, "readFile" | "fileExists">

Filesystem host functions which are aware of the "virtual" [eval].ts, <repl>, or [stdin].ts file used to compile REPL inputs. Must be passed to create() to create a ts-node compiler service which can compile REPL inputs.

NodeLoaderHooksFormat

NodeLoaderHooksFormat: "builtin" | "commonjs" | "dynamic" | "json" | "module" | "wasm"

Register

Register: Service

Re-export of Service interface for backwards-compatibility

deprecated

use Service instead

see

{Service}

TranspilerFactory

TranspilerFactory: (options: CreateTranspilerOptions) => Transpiler

Type declaration

Variables

REGISTER_INSTANCE

REGISTER_INSTANCE: typeof REGISTER_INSTANCE = ...

Registered ts-node instance information.

VERSION

VERSION: any = ...

Export the current version.

Functions

create

Const createEsmHooks

  • Create an implementation of node's ESM loader hooks.

    This may be useful if you want to wrap or compose the loader hooks to add additional functionality or combine with another loader.

    Node changed the hooks API, so there are two possible APIs. This function detects your node version and returns the appropriate API.

    Parameters

    Returns NodeLoaderHooksAPI1 | NodeLoaderHooksAPI2

createRepl

  • Create a ts-node REPL instance.

    Pay close attention to the example below. Today, the API requires a few lines of boilerplate to correctly bind the ReplService to the ts-node Service and vice-versa.

    Usage example:

    const repl = tsNode.createRepl();
    const service = tsNode.create({...repl.evalAwarePartialHost});
    repl.setService(service);
    repl.start();

    Parameters

    Returns ReplService

register

Generated using TypeDoc