ts-auto-guard
Advanced tools
Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8
{ | ||
"name": "ts-auto-guard", | ||
"version": "1.0.0-alpha.7", | ||
"version": "1.0.0-alpha.8", | ||
"description": "Generate type guard functions from TypeScript interfaces", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/rhys-vdw/ts-auto-guard", |
@@ -437,2 +437,27 @@ import { each, pull } from 'lodash' | ||
testProcessProject( | ||
'generates type guards for a Pick<> type', | ||
{ | ||
'test.ts': ` | ||
interface Bar { | ||
foo: number, | ||
bar: number | ||
} | ||
/** @see {isFoo} ts-auto-guard:type-guard */ | ||
export type Foo = Pick<Bar, "foo">`, | ||
}, | ||
{ | ||
'test.guard.ts': ` | ||
import { Foo } from "./test"; | ||
export function isFoo(obj: any, _argumentName?: string): obj is Foo { | ||
return ( | ||
typeof obj === "object" && | ||
typeof obj.foo === "number" | ||
) | ||
}`, | ||
} | ||
) | ||
testProcessProject( | ||
'generates type guards with a short circuit', | ||
@@ -439,0 +464,0 @@ { |
80545
1429