Table of contents

Typescript

%3 cluster_9c322fef_9c4a_4c12_b75d_8a07d8defe90 Typescript cluster_29e9adfa_3f1a_4ebd_916b_a0a2143472ac Disable type-checking on running _e5432eb2_bd08_44db_9f74_ce97b16ee787 Manually trigger type check _b988f988_9d45_4277_9dcb_072db7466e57 Per-file basis _32651985_0e4d_47ad_b59f_eab52ddba86b Temporarily _32651985_0e4d_47ad_b59f_eab52ddba86b->_e5432eb2_bd08_44db_9f74_ce97b16ee787 _4bc06950_b89e_4c90_b1f0_0c6c80aaf313 Relevant environment variables _9ac8e398_f731_4dfc_9f1a_b92702a6dec8 Reactjs _9ac8e398_f731_4dfc_9f1a_b92702a6dec8->__0:cluster_9c322fef_9c4a_4c12_b75d_8a07d8defe90 _25a365cd_e157_4bf9_b873_10d34faa2054 Javascript _64185c50_ca27_4aa6_9c24_e2a28adbf8f4 Angular (JS framework) _64185c50_ca27_4aa6_9c24_e2a28adbf8f4->_9ac8e398_f731_4dfc_9f1a_b92702a6dec8 _64185c50_ca27_4aa6_9c24_e2a28adbf8f4->__1:cluster_9c322fef_9c4a_4c12_b75d_8a07d8defe90 __2:cluster_9c322fef_9c4a_4c12_b75d_8a07d8defe90->_25a365cd_e157_4bf9_b873_10d34faa2054

A typed version of Javascript

Disable type-checking on running

Temporarily

  • Set environment variable TS_NODE_TRANSPILE_ONLY=true

export TS_NODE_TRANSPILE_ONLY=true

Improves startup time (for example of ts-node or jasmine-ts) in exchange for not checking that the types are correct.

Might be useful when a watcher (like nodemon) is left to run typescript tests every time there's a change on a file, this can get the "compilation" time before the tests are run from >30seconds to close to 0.

See Manually trigger type check to manually trigger a type-check.

Per-file basis

In TypeScript 3.7, type checking will be disabled on a file if it starts with the following comment:

// @ts-nocheck

As already mentioned, in previous versions you can disable checking on a single line by including the following comment on the previous line:

// @ts-ignore

Manually trigger type check

Just call tsc on your tsconfig.json file. Use the --noEmit flag to avoid generating JS code, which might take significant time.

Relevant environment variables

Open ts-node/src/index.ts and search for process.env.

  • TS_NODE_DEBUG

  • TS_NODE_DIR

  • TS_NODE_EMIT

  • TS_NODE_SCOPE

  • TS_NODE_FILES

  • TS_NODE_PRETTY

  • TS_NODE_COMPILER

  • TS_NODE_COMPILER_OPTIONS

  • TS_NODE_IGNORE

  • TS_NODE_PROJECT

  • TS_NODE_SKIP_PROJECT

  • TS_NODE_SKIP_IGNORE

  • TS_NODE_PREFER_TS_EXTS

  • TS_NODE_IGNORE_DIAGNOSTICS

  • TS_NODE_TRANSPILE_ONLY

  • TS_NODE_TYPE_CHECK

  • TS_NODE_COMPILER_HOST

  • TS_NODE_LOG_ERROR