dominikg / tsconfck

A utility to find and parse tsconfig files without depending on typescript
Other
293 stars 14 forks source link
tsconfig typescript

tsconfck

npm version CI

A utility to find and parse tsconfig files without depending on typescript

Why

Because no simple official api exists and tsconfig isn't actual json.

Features

Users

Used by vite*, vite-tsconfig-paths, astro and many more

(*) vite bundles tsconfck so it is listed as a devDependency

Install

npm install --save-dev tsconfck # or pnpm, yarn

Usage

import { parse } from 'tsconfck';
const {
    tsconfigFile, // full path to found tsconfig
    tsconfig, // tsconfig object including merged values from extended configs
    extended, // separate unmerged results of all tsconfig files that contributed to tsconfig
    solution, // solution result if tsconfig is part of a solution
    referenced // referenced tsconfig results if tsconfig is a solution
} = await parse('foo/bar.ts');

Links

package readme api changelog

Develop

This repo uses

In every PR you have to add a changeset by running pnpm changeset and following the prompts

PRs are going to be squash-merged

# install dependencies
pnpm install
# run tests
pnpm test

License

MIT