UNPKG

@visulima/tsconfig

Version:

Find and/or parse the tsconfig.json file from a directory path.

22 lines (21 loc) 1.1 kB
import type { Options as ReadTsConfigOptions } from "./read-tsconfig.d.ts"; import type { TsConfigJsonResolved } from "./types.d.ts"; export type Options = ReadTsConfigOptions & { cache?: Map<string, TsConfigJsonResolved> | boolean; configFileName?: string; }; export type TsConfigResult = { config: TsConfigJsonResolved; path: string; }; /** * An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first, * second attempt is to look for the "jsconfig.json" file from a given current working directory. * @param cwd Optional. The current working directory from which to search for the "tsconfig.json" file. * The type of `cwd` is `string`. * @returns A `Promise` that resolves to the TSConfig result object. * The return type of the function is `Promise&lt;TsConfigResult>`. * @throws An `Error` when the "tsconfig.json" file is not found. */ export declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>; export declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;