Skip to content

TypeScript Go (tsgo)

TypeScript 7 is a native Go port of the TypeScript compiler (codenamed tsgo). It targets the same language semantics as TypeScript 5/6 but is significantly faster — benchmarks show 10× or more improvement on large codebases.

Install @typescript/native-preview to get the tsgo binary (TypeScript 7 dev preview). Separately, apply the TypeScript 6.0 migration checklist to your tsconfig.json to avoid deprecation errors when fully upgrading.

Terminal window
npm i @typescript/native-preview

This installs the tsgo binary. You can expose it as an optional script for native checks:

package.json
{
"scripts": {
"typecheck:tsgo": "tsgo --noEmit"
}
}

TypeScript 6.0 is the version that bridges the legacy TypeScript 5 compiler and the forthcoming TypeScript 7 (tsgo). Most changes are new defaults and deprecations preparing for 7.0.

OptionTS 5 defaultTS 6 default
strictfalsetrue
targetES3es2025
moduleCommonJSes2022 (resolved from target)
moduleResolutionnode10bundler
rootDirinferred from source files. (tsconfig directory)
typesall @types auto-included[] (none)
noUncheckedSideEffectImportsfalsetrue
libReplacementtruefalse
esModuleInteropfalsetrue

All deprecations in TS 6 become hard removals in TS 7:

Deprecated option/valueMigration
target: "es3" / "es5"target: "es2015" or higher
downlevelIterationRemove entirely
moduleResolution: "node" / "node10""nodenext" or "bundler"
moduleResolution: "classic""nodenext" or "bundler"
module: "amd" / "umd" / "system" / "none""esnext", "commonjs", "nodenext"
baseUrlInline value into paths entries
esModuleInterop: falseRemove (always true)
allowSyntheticDefaultImports: falseRemove (always true)
alwaysStrict: falseRemove (always strict)
outFileUse a bundler
module Foo {} namespace syntaxnamespace Foo {}
import ... assert {} import assertionsimport ... with {}

Priority 1 — likely breaking for most projects:

  1. Set "types": ["node"] (or all @types packages you need) — types are no longer auto-discovered.
  2. Set "rootDir": "./src" if you were relying on inference (source files in a subdirectory).
  3. Review the new strict: true default — set "strict": false if not ready.

Priority 2 — common adjustments:

  1. Set explicit target if you need something other than es2025.
  2. Set explicit module if you need CommonJS output.
  3. Remove baseUrl and inline its value into paths entries.
  4. Replace import ... assert {} with import ... with {}.
  5. Replace module Foo {} with namespace Foo {}.
  6. If you have side-effect imports that do not resolve, set "noUncheckedSideEffectImports": false.

Priority 3 — deprecated options to remove:

Remove downlevelIteration, outFile, alwaysStrict: false, esModuleInterop: false, allowSyntheticDefaultImports: false, and update legacy moduleResolution / module values.

Add "ignoreDeprecations": "6.0" to tsconfig.json to silence deprecation warnings while you migrate. This will not work in TypeScript 7.

{
"compilerOptions": {
"ignoreDeprecations": "6.0"
}
}

The ts5to6 tool (by a TypeScript team member) automates the two most disruptive changes — baseUrl removal and rootDir inference:

Terminal window
npx @andrewbranch/ts5to6 --fixBaseUrl .
npx @andrewbranch/ts5to6 --fixRootDir .