Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -6,3 +6,5 @@ cases/typia/build
cases/deepkit/build
cases/ts-auto-guard/build
cases/ts-auto-guard/src/index.guard.ts
cases/type-predicate-generator/build
cases/type-predicate-generator/src/index_guards.ts
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,9 @@ cases/typia/build
cases/ts-auto-guard/build
cases/ts-auto-guard/src/index.guard.ts

# type-predicate-generator build artifacts
cases/type-predicate-generator/build
cases/type-predicate-generator/src/index_guards.ts

# Bun binary lock file makes mergin harder. Using text lock file instead.
bun.lockb
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* [ts-runtime-checks](https://github.com/GoogleFeud/ts-runtime-checks)
* [tson](https://github.com/skarab42/tson)
* [ts-utils](https://github.com/ai-labs-team/ts-utils)
* [type-predicate-generator](https://github.com/peter-leonov/typescript-predicate-generator)
* [typia](https://github.com/samchon/typia)
* [@typeofweb/schema](https://github.com/typeofweb/schema)
* [unknownutil](https://github.com/lambdalisue/deno-unknownutil)
Expand Down
1 change: 1 addition & 0 deletions cases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const cases = [
'deepkit',
'effect-schema',
'ts-auto-guard',
'type-predicate-generator',
'jet-schema',
] as const;

Expand Down
7 changes: 7 additions & 0 deletions cases/type-predicate-generator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { isLoose } from './src/index_guards';
import { addCase } from '../../benchmarks';

addCase('type-predicate-generator', 'assertLoose', data => {
if (!isLoose(data)) throw new Error('wrong type.');
return true;
});
13 changes: 13 additions & 0 deletions cases/type-predicate-generator/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export type Loose = {
number: number;
negNumber: number;
maxNumber: number;
string: string;
longString: string;
boolean: boolean;
deeplyNested: {
foo: string;
num: number;
bool: boolean;
};
};
10 changes: 10 additions & 0 deletions cases/type-predicate-generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "build",
"strict": true,
"strictNullChecks": true
},
"include": ["src/index.ts", "src/index_guards.ts"]
}
4 changes: 4 additions & 0 deletions download-packages-popularity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export const packages = [
name: 'ts-auto-guard',
packageName: 'ts-auto-guard',
},
{
name: 'type-predicate-generator',
packageName: 'type-predicate-generator',
},
] as const;

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

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

Expand Down
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"lint": "gts check",
"lint:fix": "gts fix",
"start": "ts-node index.ts",
"test:build": "npm run compile:spectypes && npm run compile:ts-runtime-checks && npm run compile:typebox && npm run compile:typia && npm run compile:deepkit && npm run compile:ts-auto-guard && tsc --noEmit",
"test": "npm run compile:spectypes && npm run compile:ts-runtime-checks && npm run compile:typebox && npm run compile:typia && npm run compile:deepkit && npm run compile:ts-auto-guard && vitest run",
"test:build": "npm run compile:spectypes && npm run compile:ts-runtime-checks && npm run compile:typebox && npm run compile:typia && npm run compile:deepkit && npm run compile:ts-auto-guard && npm run compile:type-predicate-generator && tsc --noEmit",
"test": "npm run compile:spectypes && npm run compile:ts-runtime-checks && npm run compile:typebox && npm run compile:typia && npm run compile:deepkit && npm run compile:ts-auto-guard && npm run compile:type-predicate-generator && vitest run",
"docs:serve": "serve docs",
"docs:watch": "tsc --project tsconfig.docs.json --watch --preserveWatchOutput & serve docs",
"docs:build": "tsc --project tsconfig.docs.json",
Expand All @@ -23,6 +23,7 @@
"compile:typebox": "ts-node cases/typebox/index.ts cases/typebox/build",
"compile:typia": "rimraf cases/typia/build && tsc -p cases/typia/tsconfig.json",
"compile:ts-auto-guard": "rimraf cases/ts-auto-guard/build && ts-auto-guard --project cases/ts-auto-guard/tsconfig.json && tsc -p cases/ts-auto-guard/tsconfig.json",
"compile:type-predicate-generator": "rimraf cases/type-predicate-generator/src/index_guards.ts && (cd cases/type-predicate-generator/src && type-predicate-generator ./index.ts) && tsc -p cases/type-predicate-generator/tsconfig.json",
"prepare": "ts-patch install",
"download-packages-popularity": "ts-node download-packages-popularity.ts"
},
Expand Down Expand Up @@ -87,6 +88,7 @@
"ts-json-validator": "0.7.1",
"ts-node": "10.9.2",
"ts-runtime-checks": "0.6.3",
"type-predicate-generator": "0.1.11",
"typescript": "5.6.3",
"typia": "7.5.1",
"undici": "7.2.1",
Expand Down
1 change: 1 addition & 0 deletions test/benchmarks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import '../cases/zod';
import '../cases/deepkit';
import '../cases/effect-schema';
import '../cases/ts-auto-guard';
import '../cases/type-predicate-generator';
import '../cases/tiny-schema-validator';
import '../cases/jet-schema';

Expand Down
Loading