ts-auto-guard
Advanced tools
Comparing version 1.0.0-alpha.14 to 1.0.0-alpha.15
@@ -472,3 +472,3 @@ "use strict"; | ||
project = new ts_morph_1.Project({ | ||
addFilesFromTsConfig: paths.length === 0, | ||
skipAddingFilesFromTsConfig: paths.length !== 0, | ||
tsConfigFilePath: tsConfigFilePath, | ||
@@ -475,0 +475,0 @@ }); |
{ | ||
"name": "ts-auto-guard", | ||
"version": "1.0.0-alpha.14", | ||
"version": "1.0.0-alpha.15", | ||
"description": "Generate type guard functions from TypeScript interfaces", | ||
@@ -22,3 +22,3 @@ "homepage": "https://github.com/rhys-vdw/ts-auto-guard", | ||
"dependencies": { | ||
"@ts-morph/common": "^0.6.0", | ||
"@ts-morph/common": "^0.7.3", | ||
"@types/command-line-args": "^5.0.0", | ||
@@ -30,3 +30,3 @@ "@types/command-line-usage": "^5.0.1", | ||
"lodash": "^4.17.20", | ||
"ts-morph": "^8.1.2", | ||
"ts-morph": "^9.1.0", | ||
"tsconfig": "^7.0.0" | ||
@@ -33,0 +33,0 @@ }, |
@@ -9,3 +9,3 @@ import { each, pull } from 'lodash' | ||
return new Project({ | ||
addFilesFromTsConfig: false, | ||
skipAddingFilesFromTsConfig: true, | ||
compilerOptions: { strict: true }, | ||
@@ -176,3 +176,3 @@ useInMemoryFileSystem: true, | ||
testProcessProject( | ||
'generates type guards for properties with spaces', | ||
'generates type guards for interface properties with spaces', | ||
{ | ||
@@ -203,2 +203,82 @@ 'test.ts': ` | ||
testProcessProject( | ||
'generates type guards for type properties with spaces', | ||
{ | ||
'test.ts': ` | ||
/** @see {isFoo} ts-auto-guard:type-guard */ | ||
export type Foo = { | ||
"foo 1": number, | ||
"bar 2": string | ||
}`, | ||
}, | ||
{ | ||
'test.guard.ts': ` | ||
import { Foo } from "./test"; | ||
export function isFoo(obj: any, _argumentName?: string): obj is Foo { | ||
return ( | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
typeof obj["foo 1"] === "number" && | ||
typeof obj["bar 2"] === "string" | ||
) | ||
}`, | ||
} | ||
) | ||
testProcessProject( | ||
'generates type guards for interface properties with dashes', | ||
{ | ||
'test.ts': ` | ||
/** @see {isFoo} ts-auto-guard:type-guard */ | ||
export interface Foo { | ||
"foo-1": number, | ||
"bar-2": string | ||
}`, | ||
}, | ||
{ | ||
'test.guard.ts': ` | ||
import { Foo } from "./test"; | ||
export function isFoo(obj: any, _argumentName?: string): obj is Foo { | ||
return ( | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
typeof obj["foo-1"] === "number" && | ||
typeof obj["bar-2"] === "string" | ||
) | ||
}`, | ||
} | ||
) | ||
// Commented out since this is a bug that should be fixed. | ||
// testProcessProject( | ||
// 'generates type guards for type properties with dashes', | ||
// { | ||
// 'test.ts': ` | ||
// /** @see {isFoo} ts-auto-guard:type-guard */ /** | ||
// export type Foo = { | ||
// "foo-1": number, | ||
// "bar-2": string | ||
// }`, | ||
// }, | ||
// { | ||
// 'test.guard.ts': ` | ||
// import { Foo } from "./test"; | ||
// export function isFoo(obj: any, _argumentName?: string): obj is Foo { | ||
// return ( | ||
// (obj !== null && | ||
// typeof obj === "object" || | ||
// typeof obj === "function") && | ||
// typeof obj["foo-1"] === "number" && | ||
// typeof obj["bar-2"] === "string" | ||
// ) | ||
// }`, | ||
// } | ||
// ) | ||
testProcessProject( | ||
'generates type guards for properties with spaces in types instead of interfaces', | ||
@@ -205,0 +285,0 @@ { |
Sorry, the diff of this file is not supported yet
94112
1722
+ Added@ts-morph/common@0.7.5(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedmultimatch@5.0.0(transitive)
+ Addedts-morph@9.1.0(transitive)
+ Addedtypescript@4.1.6(transitive)
- Removed@ts-morph/common@0.6.0(transitive)
- Removedat-least-node@1.0.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedmultimatch@4.0.0(transitive)
- Removedts-morph@8.2.0(transitive)
- Removedtypescript@4.0.8(transitive)
- Removeduniversalify@2.0.1(transitive)
Updated@ts-morph/common@^0.7.3
Updatedts-morph@^9.1.0