import * as ts from 'typescript'; /** * TypeScript Transformer that enforces handling of declared thrown errors. * * This transformer: * 1. Finds all call expressions * 2. Checks if the called function returns Throws * 3. Extracts the error types E * 4. Verifies the call is either: * a) Inside a try-catch that handles those error types * b) Inside a function that propagates those error types in its return type * 5. Emits diagnostics for unhandled errors * * Usage with ts-patch: * // tsconfig.json * { * "compilerOptions": { * "plugins": [{ "transform": "./transformer.ts" }] * } * } */ interface TransformerConfig { strictCatchHandling?: boolean; } /** * Create the transformer factory. */ export default function transformer(program: ts.Program, config?: TransformerConfig): ts.TransformerFactory; export declare function checkFile(fileName: string, compilerOptions?: ts.CompilerOptions): ts.Diagnostic[]; export {};