aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Types.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-07-11 02:26:24 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-07-11 02:26:24 -0400
commita1c6b6df4eb6a30bca9603dac449dc937fb479fc (patch)
tree3d0dd2d041f333fc8ddf594c0c4415df7b6d8e56 /src/new_fields/Types.ts
parent4b3c7ea33d564711566232acf2e8450aee1219fc (diff)
parentb1b69f8a4f9e34f0c8e667ec95f9fe16ebc8b2e4 (diff)
merged with master and fixed linter / errors
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 39d384d64..f8a4a30b4 100644
--- a/src/new_fields/Types.ts
+++ b/src/new_fields/Types.ts
@@ -1,6 +1,7 @@
import { Field, Opt, FieldResult, Doc } from "./Doc";
import { List } from "./List";
import { RefField } from "./RefField";
+import { DateField } from "./DateField";
export type ToType<T extends InterfaceValue> =
T extends "string" ? string :
@@ -80,6 +81,9 @@ export function StrCast(field: FieldResult, defaultVal: string | null = "") {
export function BoolCast(field: FieldResult, defaultVal: boolean | null = null) {
return Cast(field, "boolean", defaultVal);
}
+export function DateCast(field: FieldResult) {
+ return Cast(field, DateField, null);
+}
type WithoutList<T extends Field> = T extends List<infer R> ? (R extends RefField ? (R | Promise<R>)[] : R[]) : T;