From 457ab3301782e4e91334961208c5e4bbde95987d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 10 Dec 2021 03:04:34 +0100 Subject: Add various type specifiers. --- static/clock.ts | 5 ++--- static/components/changelog.ts | 2 +- static/components/input-list.ts | 2 +- static/components/tab-group-element.ts | 2 +- static/components/vevent-description.ts | 4 ---- static/vevent.ts | 10 +++++----- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/static/clock.ts b/static/clock.ts index a2d22e00..b0ddae00 100644 --- a/static/clock.ts +++ b/static/clock.ts @@ -2,9 +2,8 @@ export { SmallcalCellHighlight, Timebar } import { makeElement, date_to_percent } from './lib' -class Clock { - update(now: Date) { - } +abstract class Clock { + abstract update(now: Date): void; } diff --git a/static/components/changelog.ts b/static/components/changelog.ts index 8f45794d..831e4ced 100644 --- a/static/components/changelog.ts +++ b/static/components/changelog.ts @@ -6,7 +6,7 @@ export { VEventChangelog } class VEventChangelog extends ComponentVEvent { - ul: HTMLElement + readonly ul: HTMLElement constructor(uid?: string) { super(uid); diff --git a/static/components/input-list.ts b/static/components/input-list.ts index 899e8f4f..c31066da 100644 --- a/static/components/input-list.ts +++ b/static/components/input-list.ts @@ -10,7 +10,7 @@ class InputList extends HTMLElement { el: HTMLInputElement; - _listeners: [string, (e: Event) => void][] = []; + private _listeners: [string, (e: Event) => void][] = []; constructor() { super(); diff --git a/static/components/tab-group-element.ts b/static/components/tab-group-element.ts index dc97df93..e84da19f 100644 --- a/static/components/tab-group-element.ts +++ b/static/components/tab-group-element.ts @@ -21,7 +21,7 @@ export { TabGroupElement } */ class TabGroupElement extends ComponentVEvent { - menu: HTMLElement; + readonly menu: HTMLElement; tabs: HTMLElement[] = []; tabLabels: HTMLElement[] = []; diff --git a/static/components/vevent-description.ts b/static/components/vevent-description.ts index b1605d50..09c836b0 100644 --- a/static/components/vevent-description.ts +++ b/static/components/vevent-description.ts @@ -8,10 +8,6 @@ import { makeElement } from '../lib' */ class ComponentDescription extends ComponentVEvent { - constructor() { - super(); - } - redraw(data: VEvent) { // update ourselves from template diff --git a/static/vevent.ts b/static/vevent.ts index 994c9425..cee26727 100644 --- a/static/vevent.ts +++ b/static/vevent.ts @@ -1,4 +1,4 @@ -import { uid, ical_type, valid_input_types, JCal, JCalProperty, ChangeLogEntry } from './types' +import { ical_type, valid_input_types, JCal, JCalProperty, ChangeLogEntry } from './types' import { parseDate } from './lib' export { @@ -91,7 +91,7 @@ All "live" calendar data in the frontend should live in an object of this type. class VEvent { /* Calendar properties */ - properties: Map + private properties: Map /* Children (such as alarms for events) */ components: VEvent[] @@ -164,7 +164,7 @@ class VEvent { return this.properties.keys() } - __setPropertyInternal(key: string, value: any, type?: ical_type) { + private setPropertyInternal(key: string, value: any, type?: ical_type) { function resolve_type(key: string, type?: ical_type): ical_type { if (type) { return type; @@ -223,7 +223,7 @@ class VEvent { setProperty(key: string, value: any, type?: ical_type): void; setProperty(key: string, value: any, type?: ical_type) { - this.__setPropertyInternal(key, value, type); + this.setPropertyInternal(key, value, type); for (let el of this.registered) { el.redraw(this); @@ -232,7 +232,7 @@ class VEvent { setProperties(pairs: [string, any, ical_type?][]) { for (let pair of pairs) { - this.__setPropertyInternal(...pair); + this.setPropertyInternal(...pair); } for (let el of this.registered) { el.redraw(this); -- cgit v1.2.3