Skip to content

Commit e729928

Browse files
authored
Fix #1661: no argument required in random boolean. (#1662)
* Fix #1661: no argument required in random boolean. * Fix test function
1 parent 2a354bb commit e729928

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "typia",
4-
"version": "9.7.1",
4+
"version": "9.7.2",
55
"description": "Superfast runtime validators with only one line",
66
"main": "lib/index.js",
77
"typings": "lib/index.d.ts",

src/programmers/RandomProgrammer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,12 @@ export namespace RandomProgrammer {
532532
internal: "randomInteger",
533533
arguments: [LiteralFactory.write(schema)],
534534
};
535-
}
535+
} else if (props.atomic.type === "boolean")
536+
return {
537+
method: props.atomic.type,
538+
internal: "randomBoolean",
539+
arguments: [],
540+
};
536541
return {
537542
method: props.atomic.type,
538543
internal: `random${StringUtil.capitalize(props.atomic.type)}`,

test/src/debug/randomBoolean.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import typia from "typia";
2+
3+
console.log(typia.createRandom<boolean>().toString());
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import typia from "typia";
2+
3+
import { TestValidator } from "../../helpers/TestValidator";
4+
5+
export const test_issue_1661_random_boolean = (): void => {
6+
const fn: string = typia.createRandom<boolean>().toString();
7+
TestValidator.predicate("no argument")(() =>
8+
fn.includes("_randomBoolean)()"),
9+
);
10+
};

0 commit comments

Comments
 (0)