aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Types.ts
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-26 17:08:38 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-26 17:08:38 -0400
commitf01b842a5d6ef6b9deb9807fa0c3a8cd2c81a25a (patch)
treec9e3b3c18dc35f4a3fa3083b69b985821041c879 /src/new_fields/Types.ts
parentc318c6cb44b26b780e94e0f0854e5ec4c14634a9 (diff)
TreeView and others
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>;