UNPKG

types-testing

Version:

Test TypeScript types at test runner runtime - Works seamlessly with Jest, Vitest, and Bun.

46 lines (45 loc) 1.3 kB
import { Assertion } from '..'; import ts from 'typescript'; /** @internal */ export declare const getTypeChecker: (program: ts.Program) => TypeChecker; /** @internal */ export type TypeChecker = ts.TypeChecker & { /** @internal */ __internal: { /** @internal */ identifyTestCall(node: ts.Node): IdentifiedTestCall; /** @internal */ postIdentifyTestCall(node: ts.CallExpression, forExpectCall: boolean): { callerNode: ts.Node | ts.LeftHandSideExpression; assertionCallExpressionText?: string; expectCallExpressionText?: string; }; }; }; /** @internal */ export type AssertionName = keyof typeof Assertion; /** @internal */ export type AssertionFn = (typeof Assertion)[AssertionName]; type AssertionCallProps = { assertionFn: AssertionFn; receivedType?: ts.Type; expectedType?: ts.Type; receivedTypeString?: string; expectedTypeString?: string; isNegated: boolean; needTypeArgument: boolean; }; type ExpectCallProps = { receivedType?: ts.Type; expectedType?: never; isNegated?: never; needTypeArgument?: never; }; type IdentifiedTestCall = null | { type: 'assertion'; props: AssertionCallProps; } | { type: 'expect'; props: ExpectCallProps; }; export {};