diff options
| author | bobzel <zzzman@gmail.com> | 2022-03-02 14:43:48 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2022-03-02 14:43:48 -0500 |
| commit | 398a50bc1d7e77691620a4a6752fd38d4bb391b0 (patch) | |
| tree | 42f56a2bc7cc1d661c3dfa61d49cc472fffb553c /src/fields | |
| parent | 35f0c9940d0ea7c0cb37c711557454b77ac038ad (diff) | |
upgraded to typescript 4.6.2
Diffstat (limited to 'src/fields')
| -rw-r--r-- | src/fields/CursorField.ts | 2 | ||||
| -rw-r--r-- | src/fields/Doc.ts | 2 | ||||
| -rw-r--r-- | src/fields/ObjectField.ts | 2 | ||||
| -rw-r--r-- | src/fields/SchemaHeaderField.ts | 12 | ||||
| -rw-r--r-- | src/fields/Types.ts | 3 |
5 files changed, 11 insertions, 10 deletions
diff --git a/src/fields/CursorField.ts b/src/fields/CursorField.ts index 28467377b..a8a2859d2 100644 --- a/src/fields/CursorField.ts +++ b/src/fields/CursorField.ts @@ -50,7 +50,7 @@ export default class CursorField extends ObjectField { setPosition(position: CursorPosition) { this.data.position = position; this.data.metadata.timestamp = Date.now(); - this[OnUpdate](); + this[OnUpdate]?.(); } [Copy]() { diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 0b9a8b3fe..63c67aeb0 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -216,7 +216,7 @@ export class Doc extends RefField { return self.resolvedDataDoc && !self.isTemplateForField ? self : Doc.GetProto(Cast(Doc.Layout(self).resolvedDataDoc, Doc, null) || self); } - @computed get __LAYOUT__() { + @computed get __LAYOUT__(): Doc | undefined { const templateLayoutDoc = Cast(Doc.LayoutField(this[SelfProxy]), Doc, null); if (templateLayoutDoc) { let renderFieldKey: any; diff --git a/src/fields/ObjectField.ts b/src/fields/ObjectField.ts index 92b2cfa60..9211afe86 100644 --- a/src/fields/ObjectField.ts +++ b/src/fields/ObjectField.ts @@ -3,7 +3,7 @@ import { OnUpdate, Parent, Copy, ToScriptString, ToString } from "./FieldSymbols import { Scripting } from "../client/util/Scripting"; export abstract class ObjectField { - public [OnUpdate](diff?: any) { } + public [OnUpdate]?: (diff?: any) => void; public [Parent]?: RefField | ObjectField; abstract [Copy](): ObjectField; diff --git a/src/fields/SchemaHeaderField.ts b/src/fields/SchemaHeaderField.ts index a53fa542e..3dc70ac19 100644 --- a/src/fields/SchemaHeaderField.ts +++ b/src/fields/SchemaHeaderField.ts @@ -82,32 +82,32 @@ export class SchemaHeaderField extends ObjectField { setHeading(heading: string) { this.heading = heading; - this[OnUpdate](); + this[OnUpdate]?.(); } setColor(color: string) { this.color = color; - this[OnUpdate](); + this[OnUpdate]?.(); } setType(type: ColumnType) { this.type = type; - this[OnUpdate](); + this[OnUpdate]?.(); } setWidth(width: number) { this.width = width; - this[OnUpdate](); + this[OnUpdate]?.(); } setDesc(desc: boolean | undefined) { this.desc = desc; - this[OnUpdate](); + this[OnUpdate]?.(); } setCollapsed(collapsed: boolean | undefined) { this.collapsed = collapsed; - this[OnUpdate](); + this[OnUpdate]?.(); } [Copy]() { diff --git a/src/fields/Types.ts b/src/fields/Types.ts index 220a30fe4..c90f3b6b3 100644 --- a/src/fields/Types.ts +++ b/src/fields/Types.ts @@ -111,5 +111,6 @@ export interface PromiseLike<T> { then(callback: (field: Opt<T>) => void): void; } export function PromiseValue<T extends Field>(field: FieldResult<T>): PromiseLike<Opt<T>> { - return field instanceof Promise ? field : { then(cb: ((field: Opt<T>) => void)) { return cb(field); } }; + if (field instanceof Promise) return field as Promise<Opt<T>>; + return { then(cb: ((field: Opt<T>) => void)) { return cb(field); } }; }
\ No newline at end of file |
