From 0fbee32c27a6efdfe88534303922d189ddbba817 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Tue, 17 Aug 2021 05:07:38 +0530 Subject: Typescript conversion (#1805) --- src/models/News.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/models/News.ts (limited to 'src/models/News.ts') diff --git a/src/models/News.ts b/src/models/News.ts new file mode 100644 index 000000000..3db812937 --- /dev/null +++ b/src/models/News.ts @@ -0,0 +1,29 @@ +// @flow + +interface INews { + id: string; + message: string; + type: string; + sticky: boolean | undefined; +} + +export default class News { + id: string = ''; + + message: string = ''; + + type: string = 'primary'; + + sticky: boolean = false; + + constructor(data: INews) { + if (!data.id) { + throw Error('News requires Id'); + } + + this.id = data.id; + this.message = data.message || this.message; + this.type = data.type || this.type; + this.sticky = data.sticky !== undefined ? data.sticky : this.sticky; + } +} -- cgit v1.2.3-70-g09d2