Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ cases/spectypes/build
cases/ts-runtime-checks/build
cases/typia/build
cases/deepkit/build
cases/ts-auto-guard/build
cases/ts-auto-guard/src/index.guard.ts
jest.config.js
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,8 @@ cases/spectypes/build
cases/ts-runtime-checks/build

# typia build artifacts
cases/typia/build
cases/typia/build

# ts-auto-guard build artifacts
cases/ts-auto-guard/build
cases/ts-auto-guard/src/index.guard.ts
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* [Vality](https://github.com/jeengbe/vality)
* [yup](https://github.com/jquense/yup)
* [zod](https://github.com/vriad/zod)
* [ts-auto-guard](https://github.com/rhys-vdw/ts-auto-guard)
Comment thread
moltar marked this conversation as resolved.
Outdated

## Criteria

Expand Down
1 change: 1 addition & 0 deletions cases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const cases = [
'zod',
'deepkit',
'effect-schema',
'ts-auto-guard',
] as const;

export type CaseName = (typeof cases)[number];
Expand Down
7 changes: 7 additions & 0 deletions cases/ts-auto-guard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { isLoose } from './build/index.guard';
import { addCase } from '../../benchmarks';

addCase('ts-auto-guard', 'assertLoose', data => {
if (!isLoose(data)) throw new Error('wrong type.');
return true;
});
14 changes: 14 additions & 0 deletions cases/ts-auto-guard/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @see {isLoose} ts-auto-guard:type-guard */
export interface Loose {
number: number;
negNumber: number;
maxNumber: number;
string: string;
longString: string;
boolean: boolean;
deeplyNested: {
foo: string;
num: number;
bool: boolean;
};
}
11 changes: 11 additions & 0 deletions cases/ts-auto-guard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "build",
"strict": true,
"strictNullChecks": true,
},
"include": ["src/index.ts", "src/index.guard.ts"]
}

5 changes: 5 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ async function main() {
stdio: 'inherit',
});
}
if (c === 'ts-auto-guard') {
childProcess.execSync('npm run compile:ts-auto-guard', {
stdio: 'inherit',
});
}

const cmd = [...process.argv.slice(0, 2), 'run-internal', c];

Expand Down
Loading