ts-auto-guard
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -457,8 +457,8 @@ "use strict"; | ||
} | ||
if (type.isTuple()) { | ||
return tupleCondition(varName, type, addDependency, project, path, arrayDepth, records, outFile, options); | ||
} | ||
if (type.isObject()) { | ||
return objectCondition(varName, type, addDependency, project, path, arrayDepth, records, outFile, options); | ||
} | ||
if (type.isTuple()) { | ||
return tupleCondition(varName, type, addDependency, project, path, arrayDepth, records, outFile, options); | ||
} | ||
if (type.isLiteral()) { | ||
@@ -465,0 +465,0 @@ return literalCondition(varName, type, addDependency); |
{ | ||
"name": "ts-auto-guard", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Generate type guard functions from TypeScript interfaces", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/rhys-vdw/ts-auto-guard", |
@@ -1559,1 +1559,27 @@ import test from 'tape' | ||
) | ||
testProcessProject( | ||
'generates tuples', | ||
{ | ||
'test.ts': ` | ||
export interface A { | ||
b: [number] | ||
}`, | ||
}, | ||
{ | ||
'test.ts': null, | ||
'test.guard.ts': ` | ||
import { A } from "./test"; | ||
export function isA(obj: any, _argumentName?: string): obj is A { | ||
return ( | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
Array.isArray(obj.b) && | ||
typeof obj.b[0] === "number" | ||
) | ||
}`, | ||
}, | ||
{ options: { exportAll: true } } | ||
) |
Sorry, the diff of this file is not supported yet
134377
2707