From 88aa9fc038a7379b3ea9e66bee6b5e71f07d858c Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sun, 22 Mar 2020 10:18:25 -0400 Subject: [PATCH] forum: create app.ts file that exports Forum instance This file can now be imported so 'app' is an instance of Forum instead of just Application - for typings --- js/src/forum/Forum.ts | 4 ++-- js/src/forum/app.ts | 8 ++++++++ js/src/forum/components/NotificationList.tsx | 2 ++ js/src/forum/components/PostStream.tsx | 2 +- js/src/forum/index.ts | 7 +------ 5 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 js/src/forum/app.ts diff --git a/js/src/forum/Forum.ts b/js/src/forum/Forum.ts index e9def2ffa..117c446c1 100644 --- a/js/src/forum/Forum.ts +++ b/js/src/forum/Forum.ts @@ -32,8 +32,8 @@ export default class Forum extends Application { // discussionRenamed: DiscussionRenamedPost }; - previous: Page; - current: Page; + previous?: Page; + current?: Page; constructor() { super(); diff --git a/js/src/forum/app.ts b/js/src/forum/app.ts new file mode 100644 index 000000000..d63771511 --- /dev/null +++ b/js/src/forum/app.ts @@ -0,0 +1,8 @@ +import Forum from './Forum'; + +const app = new Forum(); + +// @ts-ignore +window.app = app; + +export default app; diff --git a/js/src/forum/components/NotificationList.tsx b/js/src/forum/components/NotificationList.tsx index bca6f177f..19f1e3c52 100644 --- a/js/src/forum/components/NotificationList.tsx +++ b/js/src/forum/components/NotificationList.tsx @@ -1,3 +1,5 @@ +import app from '../app'; + import Component from '../../common/Component'; import listItems from '../../common/helpers/listItems'; import Button from '../../common/components/Button'; diff --git a/js/src/forum/components/PostStream.tsx b/js/src/forum/components/PostStream.tsx index 07857b635..0e877dac0 100644 --- a/js/src/forum/components/PostStream.tsx +++ b/js/src/forum/components/PostStream.tsx @@ -6,7 +6,7 @@ import ReplyPlaceholder from './ReplyPlaceholder'; import Button from '../../common/components/Button'; import Discussion from '../../common/models/Discussion'; import Post from '../../common/models/Post'; -import Evented from '../../common/utils/evented'; +import Evented from '../../common/utils/Evented'; import { DiscussionProp } from '../../common/concerns/ComponentProps'; import { Attributes } from 'mithril'; diff --git a/js/src/forum/index.ts b/js/src/forum/index.ts index a439d2885..e543c63d3 100644 --- a/js/src/forum/index.ts +++ b/js/src/forum/index.ts @@ -1,9 +1,4 @@ -import Forum from './Forum'; - -const app = new Forum(); - -// @ts-ignore -window.app = app; +import app from './app'; export { app };