aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields/Types.ts')
-rw-r--r--src/fields/Types.ts10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/fields/Types.ts b/src/fields/Types.ts
index c90f3b6b3..3d784448d 100644
--- a/src/fields/Types.ts
+++ b/src/fields/Types.ts
@@ -3,7 +3,6 @@ import { List } from "./List";
import { RefField } from "./RefField";
import { DateField } from "./DateField";
import { ScriptField } from "./ScriptField";
-import { URLField, WebField, ImageField } from "./URLField";
export type ToType<T extends InterfaceValue> =
T extends "string" ? string :
@@ -92,12 +91,6 @@ export function DateCast(field: FieldResult) {
export function ScriptCast(field: FieldResult, defaultVal: ScriptField | null = null) {
return Cast(field, ScriptField, defaultVal);
}
-export function WebCast(field: FieldResult, defaultVal: WebField | null = null) {
- return Cast(field, WebField, defaultVal);
-}
-export function ImageCast(field: FieldResult, defaultVal: ImageField | null = null) {
- return Cast(field, ImageField, defaultVal);
-}
type WithoutList<T extends Field> = T extends List<infer R> ? (R extends RefField ? (R | Promise<R>)[] : R[]) : T;
@@ -111,6 +104,5 @@ export interface PromiseLike<T> {
then(callback: (field: Opt<T>) => void): void;
}
export function PromiseValue<T extends Field>(field: FieldResult<T>): PromiseLike<Opt<T>> {
- if (field instanceof Promise) return field as Promise<Opt<T>>;
- return { then(cb: ((field: Opt<T>) => void)) { return cb(field); } };
+ return field instanceof Promise ? field : { then(cb: ((field: Opt<T>) => void)) { return cb(field); } };
} \ No newline at end of file