use-tsconfig 0.0.1

Partial tsconfig metadata primitives for RustUse
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use use_ts::{TsModuleResolution, TsStrictness, TsTarget};
use use_tsconfig::{CompilerOptions, TsConfig, TsConfigInclude};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let options = CompilerOptions::new()
        .with_target("es2022".parse::<TsTarget>()?)
        .with_module_resolution(TsModuleResolution::Bundler)
        .with_strictness(TsStrictness::Strict);
    let config = TsConfig::new()
        .with_compiler_options(options)
        .with_include(TsConfigInclude::new("src")?);

    assert_eq!(config.include().len(), 1);
    Ok(())
}