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())
    .join("test/tsconfig.default.json");
let config = TsConfig::parse_file(&path).unwrap();

Structs§

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

Enums§

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

Functions§

parse_file_to_value
Parses a .tsconfig file into a serde_json::Value.
parse_to_value
Parse a JSON string into a single serde_json::Value.

Type Aliases§

Result