@typespec/compiler
Version:
TypeSpec Compiler Preview
16 lines • 994 B
TypeScript
import { DiagnosticHandler } from "../core/diagnostics.js";
import { CompilerHost, DiagnosticTarget, NoTarget, SourceFile } from "../core/types.js";
export interface FileHandlingOptions {
allowFileNotFound?: boolean;
diagnosticTarget?: DiagnosticTarget | typeof NoTarget;
jsDiagnosticTarget?: DiagnosticTarget;
}
export declare function doIO<T>(action: (path: string) => Promise<T>, path: string, reportDiagnostic: DiagnosticHandler, options?: FileHandlingOptions): Promise<T | undefined>;
export declare function loadFile<T>(host: CompilerHost, path: string, load: (contents: string) => T, reportDiagnostic: DiagnosticHandler, options?: FileHandlingOptions): Promise<[T | undefined, SourceFile]>;
/**
* Look for the project root by looking up until a `package.json` is found.
* @param path Path to start looking
* @param lookIn
*/
export declare function findProjectRoot(statFn: CompilerHost["stat"], path: string): Promise<string | undefined>;
//# sourceMappingURL=io.d.ts.map