Crate tsconfig

source ·
Expand description

A Rust crate for parsing TypeScript’s TSConfig files into a struct.

A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project. The TSConfig file can be either a tsconfig.json or jsconfig.json; both have the same behavior and the same set of config variables.

One TSConfig can inherit fields from another if it is specified in the ‘extends’ field.

Example usage

use tsconfig::TsConfig;
use std::path::Path;

let path = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap())
let config = TsConfig::parse_file(&path).unwrap();


  • These options make up the bulk of TypeScript’s configuration and it covers how the language should work.
  • Project references setting
  • The main struct representing a parsed .tsconfig file.


  • Errors when parsing TsConfig files. This is non-exhaustive, and may be extended in the future.
  • Controls how JSX constructs are emitted in JavaScript files. This only affects output of JS files that started in .tsx files.
  • Available definitions for built-in JS APIs.
  • Sets the module system for the program.
  • Module resolution mode
  • Project references setting
  • The transpilation target for the emitted JavaScript.
  • Defines how automatic type acquisition behaves.


Type Definitions