UNPKG

ts-snippet

Version:

A TypeScript snippet testing library for any test framework

26 lines (25 loc) 951 B
import * as ts from "typescript"; import { Compiler } from "./compiler"; import { Expect } from "./expect"; export declare class Snippet { private _files; private _compiler; private _program; assertFail: (message: string) => void; assertPass: () => void; constructor(_files: { [fileName: string]: string; }, _compiler: Compiler); expect(fileName: string): Expect; fail(fileName: string, expectedMessage?: RegExp): void; infer(fileName: string, variableName: string, expectedType: string): void; succeed(fileName: string): void; private _getDiagnostics; } export declare function areEquivalentTypeStrings(a: string, b: string): boolean; export declare function getVariables(program: ts.Program, sourceFile: ts.SourceFile): { [variableName: string]: string; }; export declare function snippet(files: { [fileName: string]: string; }, compiler?: Compiler): Snippet;