UNPKG

types-testing

Version:

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

22 lines (21 loc) 632 B
import ts from "typescript"; const createErrorValue = (sourceFile, caller, expectCallExpressionText, assertionCallExpressionText, receivedType, expectedType, isNegated, need2TypeArguments) => { const position = sourceFile.getLineAndCharacterOfPosition(caller.getStart()); const filePath = ts.sys.resolvePath(sourceFile.fileName); const line = position.line + 1; const column = position.character + 1; return { filePath, line, column, expectCallExpressionText, assertionCallExpressionText, receivedType, expectedType, isNegated, need2TypeArguments }; }; export { createErrorValue };