aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/new_fields/Types.ts')
-rw-r--r--src/new_fields/Types.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/new_fields/Types.ts b/src/new_fields/Types.ts
index 079c7b76d..649dfdc3e 100644
--- a/src/new_fields/Types.ts
+++ b/src/new_fields/Types.ts
@@ -67,6 +67,10 @@ export function StrCast(field: FieldResult, defaultVal: Opt<string> = "") {
return Cast(field, "string", defaultVal);
}
+export function BoolCast(field: FieldResult, defaultVal: Opt<boolean> = undefined) {
+ return Cast(field, "boolean", defaultVal);
+}
+
type WithoutList<T extends Field> = T extends List<infer R> ? R[] : T;
export function FieldValue<T extends Field, U extends WithoutList<T>>(field: Opt<T> | Promise<Opt<T>>, defaultValue: U): WithoutList<T>;