Comparing version 0.2.0 to 0.3.0
import type * as ts from "@tsd/typescript"; | ||
import type { AssertionResult } from "../types"; | ||
export declare function expectNotAssignable(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): AssertionResult[]; | ||
export declare function expectNotAssignable(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): Array<AssertionResult>; |
import type * as ts from "@tsd/typescript"; | ||
import type { AssertionResult } from "../types"; | ||
export declare function expectType(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): AssertionResult[]; | ||
export declare function expectNotType(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): AssertionResult[]; | ||
export declare function expectType(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): Array<AssertionResult>; | ||
export declare function expectNotType(checker: ts.TypeChecker, nodes: Set<ts.CallExpression>): Array<AssertionResult>; |
@@ -12,4 +12,4 @@ import type * as ts from "@tsd/typescript"; | ||
} | ||
export declare type Handler = (typeChecker: ts.TypeChecker, nodes: Set<ts.CallExpression>) => AssertionResult[]; | ||
export declare function handleAssertions(typeChecker: ts.TypeChecker, assertions: Map<Assertion, Set<ts.CallExpression>>): AssertionResult[]; | ||
export declare type Handler = (typeChecker: ts.TypeChecker, nodes: Set<ts.CallExpression>) => Array<AssertionResult>; | ||
export declare function handleAssertions(typeChecker: ts.TypeChecker, assertions: Map<Assertion, Set<ts.CallExpression>>): Array<AssertionResult>; | ||
export declare function toAssertionResult(node: ts.Node, messageText: string | ts.DiagnosticMessageChain): AssertionResult; |
@@ -25,3 +25,3 @@ "use strict"; | ||
function handleAssertions(typeChecker, assertions) { | ||
const tadResults = []; | ||
const tsdResults = []; | ||
for (const [assertion, nodes] of assertions) { | ||
@@ -32,5 +32,5 @@ const handler = assertionHandlers.get(assertion); | ||
} | ||
tadResults.push(...handler(typeChecker, nodes)); | ||
tsdResults.push(...handler(typeChecker, nodes)); | ||
} | ||
return tadResults; | ||
return tsdResults; | ||
} | ||
@@ -37,0 +37,0 @@ exports.handleAssertions = handleAssertions; |
@@ -1,5 +0,5 @@ | ||
import * as ts from "typescript"; | ||
import * as ts from "@tsd/typescript"; | ||
export declare function resolveCompilerOptions(searchPath: string): { | ||
compilerOptions: ts.CompilerOptions; | ||
configDiagnostics: ts.Diagnostic[]; | ||
configDiagnostics: Array<ts.Diagnostic>; | ||
}; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const ts = require("typescript"); | ||
const ts = require("@tsd/typescript"); | ||
function resolveCompilerOptions(searchPath) { | ||
@@ -8,0 +8,0 @@ const configPath = ts.findConfigFile(searchPath, ts.sys.fileExists); |
@@ -1,6 +0,6 @@ | ||
import type { AssertionResult, ErrorResult, TsdResult } from "./types"; | ||
import type { TsdResult } from "./types"; | ||
export declare function tsdLite(testFilePath: string): { | ||
assertionsCount: number; | ||
tsdResults: Array<TsdResult<AssertionResult>>; | ||
tsdErrors?: Array<TsdResult<ErrorResult>>; | ||
tsdResults: Array<TsdResult>; | ||
tsdErrors?: Array<TsdResult>; | ||
}; |
@@ -45,14 +45,10 @@ "use strict"; | ||
for (const diagnostic of semanticDiagnostics) { | ||
if (!isDiagnosticWithLocation(diagnostic)) { | ||
continue; | ||
} | ||
if (/[/\\]node_modules[/\\]/.test(diagnostic.file.fileName)) { | ||
continue; | ||
} | ||
const silenceErrorResult = (0, silenceError_1.silenceError)(diagnostic, expectedErrors); | ||
if (silenceErrorResult !== "preserve") { | ||
if (silenceErrorResult !== "ignore") { | ||
expectedErrorsLocationsWithFoundDiagnostics.push(silenceErrorResult); | ||
if (isDiagnosticWithLocation(diagnostic)) { | ||
const silenceErrorResult = (0, silenceError_1.silenceError)(diagnostic, expectedErrors); | ||
if (silenceErrorResult !== "preserve") { | ||
if (silenceErrorResult !== "ignore") { | ||
expectedErrorsLocationsWithFoundDiagnostics.push(silenceErrorResult); | ||
} | ||
continue; | ||
} | ||
continue; | ||
} | ||
@@ -59,0 +55,0 @@ assertionResults.push(diagnostic); |
import type * as ts from "@tsd/typescript"; | ||
export declare type AssertionResult = { | ||
messageText: string | ts.DiagnosticMessageChain; | ||
file: ts.SourceFile; | ||
start: number; | ||
file: ts.SourceFile | undefined; | ||
start: number | undefined; | ||
}; | ||
export declare type ErrorResult = ts.Diagnostic | ts.DiagnosticWithLocation; | ||
export declare type RawResult = AssertionResult | ErrorResult; | ||
export declare type TsdResult<T extends RawResult> = { | ||
export declare type TsdResult = AssertionResult & { | ||
message: string; | ||
messageText: T["messageText"]; | ||
start: T["start"]; | ||
file: T["file"]; | ||
}; |
{ | ||
"name": "tsd-lite", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Test your TypeScript types easily", | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
"lint": "yarn lint:cspell && yarn lint:eslint && yarn lint:prettier", | ||
"lint:cspell": "cspell --gitignore --no-progress --relative --show-context --show-suggestions", | ||
"lint:cspell": "cspell --relative --show-context --show-suggestions", | ||
"lint:eslint": "eslint . --ext .ts", | ||
@@ -18,0 +18,0 @@ "lint:prettier": "prettier . --write", |
@@ -57,4 +57,4 @@ # tsd-lite | ||
messageText: string | ts.DiagnosticMessageChain; | ||
file: ts.SourceFile; | ||
start: number; | ||
file: ts.SourceFile | undefined; | ||
start: number | undefined; | ||
}>; | ||
@@ -61,0 +61,0 @@ tsdErrors?: Array<{ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
25007
454