From 2ac4cd2914217d73038836cde0e8f77cfdab1f99 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Thu, 2 Jul 2020 16:05:10 +0200 Subject: [PATCH] feat: new linting #2 --- .../global-progress-bar.service.ts | 2 +- src/app/core-ui/layout/layout.service.ts | 2 +- .../core-ui/layout/store/layout.reducer.ts | 2 +- .../core-ui/side-nav/side-nav.component.ts | 18 ++++---- .../work-context-menu.component.ts | 2 +- .../migration/legacy-persistence.sevice.ts | 36 ++++++++-------- .../keyboard-input.component.ts | 2 +- src/app/features/google/google-api.service.ts | 2 +- .../google/google-drive-sync.service.ts | 2 +- .../google-sync-cfg.component.ts | 4 +- .../google/store/google-drive-sync.effects.ts | 24 +++++------ .../google/store/google-drive-sync.reducer.ts | 2 +- .../issue/cache/issue-cache.service.ts | 2 +- .../issue-content/issue-content.component.ts | 6 +-- .../issue/issue-effect-helper.service.ts | 4 +- .../issue-header/issue-header.component.ts | 6 +-- src/app/features/issue/issue.service.ts | 6 +-- .../issue/providers/jira/jira-api.service.ts | 24 +++++------ .../jira/jira-common-interfaces.service.ts | 4 +- .../jira-issue-content.component.ts | 6 +-- .../jira-issue-header.component.ts | 3 +- .../jira/jira-issue/jira-issue.effects.ts | 3 +- .../jira-cfg-stepper.component.ts | 4 +- .../jira-cfg/jira-cfg.component.ts | 6 +-- .../metric/improvement/improvement.service.ts | 2 +- .../improvement/store/improvement.reducer.ts | 35 ++++++++++------ .../obstruction/store/obstruction.reducer.ts | 22 ++++++---- src/app/features/note/note.service.ts | 15 +++---- .../features/note/notes/notes.component.ts | 6 +-- src/app/features/note/store/note.reducer.ts | 2 +- .../planning-mode/planning-mode.service.ts | 4 +- src/app/features/pomodoro/pomodoro.service.ts | 2 +- .../pomodoro/store/pomodoro.effects.ts | 18 ++++---- .../pomodoro/store/pomodoro.reducer.ts | 2 +- src/app/features/project/project.service.ts | 4 +- .../features/project/store/project.effects.ts | 40 +++++++++--------- src/app/features/reminder/reminder.module.ts | 2 +- .../simple-counter-button.component.ts | 6 +-- .../store/simple-counter.effects.ts | 10 ++--- src/app/features/tag/store/tag.effects.ts | 18 ++++---- src/app/features/tag/store/tag.reducer.ts | 4 +- src/app/features/tag/tag/tag.component.ts | 2 +- .../store/task-repeat-cfg.effects.ts | 6 +-- .../store/task-repeat-cfg.reducer.ts | 2 +- .../sub-task-total-time-estimate.pipe.ts | 2 +- .../pipes/sub-task-total-time-spent.pipe.ts | 2 +- .../select-task/select-task.component.ts | 4 +- .../tasks/store/task-internal.effects.ts | 2 +- .../features/tasks/store/task-ui.effects.ts | 5 ++- .../features/tasks/store/task.selectors.ts | 5 ++- .../task-additional-info-item.component.ts | 8 ++-- .../task-additional-info-wrapper.component.ts | 7 ++-- .../task-additional-info.component.ts | 35 ++++++++-------- .../task-attachment-link.directive.ts | 4 +- .../task-attachment-list.component.ts | 4 +- .../task-attachment.service.ts | 7 ++-- .../tasks/task-list/task-list.component.ts | 11 ++--- .../task-summary-table.component.ts | 2 +- src/app/features/tasks/task.service.ts | 23 ++++------- src/app/features/tasks/task/task.component.ts | 41 ++++++++++--------- .../features/time-tracking/idle.service.ts | 10 ++--- .../take-a-break/take-a-break.service.ts | 10 ++--- .../features/ui-helper/ui-helper.service.ts | 3 +- .../store/work-context.effects.ts | 5 ++- .../store/work-context.reducer.ts | 2 +- .../work-view/split/split.component.html | 2 +- .../work-view/split/split.component.ts | 31 +++++++------- .../features/work-view/work-view.component.ts | 16 ++++---- .../worklog-export.component.ts | 12 +++--- .../worklog-week/worklog-week.component.ts | 8 ++-- src/app/imex/sync/sync.service.ts | 10 ++--- .../project-overview-page.component.ts | 4 +- .../schedule-page/schedule-page.component.ts | 3 +- src/app/t.const.ts | 2 +- .../input-duration-slider.component.ts | 16 ++++---- .../ui/duration/input-duration.directive.ts | 19 +++++---- .../ms-to-minute-clock-string.pipe.ts | 2 +- src/app/ui/duration/string-to-ms.pipe.ts | 2 +- .../ui/inline-input/inline-input.component.ts | 10 ++--- .../inline-markdown.component.ts | 12 +++--- .../ui/owl-wrapper/owl-wrapper.component.ts | 8 ++-- src/app/ui/pipes/sort.pipe.ts | 2 +- .../ui/progress-bar/progress-bar.component.ts | 4 +- .../ui/theme-select/theme-select.component.ts | 2 +- src/app/util/is-image-url.ts | 4 +- src/app/util/is-object.ts | 2 +- src/app/util/promise-timeout.ts | 2 +- src/tslint.json | 6 ++- 88 files changed, 389 insertions(+), 356 deletions(-) diff --git a/src/app/core-ui/global-progress-bar/global-progress-bar.service.ts b/src/app/core-ui/global-progress-bar/global-progress-bar.service.ts index 2eb6fe02e4..7fa28db0c4 100644 --- a/src/app/core-ui/global-progress-bar/global-progress-bar.service.ts +++ b/src/app/core-ui/global-progress-bar/global-progress-bar.service.ts @@ -21,7 +21,7 @@ export class GlobalProgressBarService { ); private _label$: BehaviorSubject = new BehaviorSubject(null); - label$ = this._label$.pipe( + label$: Observable = this._label$.pipe( distinctUntilChanged(), switchMap((label) => !!label ? of(label) diff --git a/src/app/core-ui/layout/layout.service.ts b/src/app/core-ui/layout/layout.service.ts index 8d6254a9db..4967142f13 100644 --- a/src/app/core-ui/layout/layout.service.ts +++ b/src/app/core-ui/layout/layout.service.ts @@ -26,7 +26,7 @@ const XS_MAX = 599; providedIn: 'root', }) export class LayoutService { - isScreenXs$ = this._breakPointObserver.observe([ + isScreenXs$: Observable = this._breakPointObserver.observe([ `(max-width: ${XS_MAX}px)`, ]).pipe(map(result => result.matches)); diff --git a/src/app/core-ui/layout/store/layout.reducer.ts b/src/app/core-ui/layout/store/layout.reducer.ts index 71ffff89ec..1a4ce6904e 100644 --- a/src/app/core-ui/layout/store/layout.reducer.ts +++ b/src/app/core-ui/layout/store/layout.reducer.ts @@ -52,7 +52,7 @@ const _reducer = createReducer( ); export function reducer( - state = _initialLayoutState, + state: LayoutState = _initialLayoutState, action: Action ): LayoutState { return _reducer(state, action); diff --git a/src/app/core-ui/side-nav/side-nav.component.ts b/src/app/core-ui/side-nav/side-nav.component.ts index f347625f99..f442e4f75e 100644 --- a/src/app/core-ui/side-nav/side-nav.component.ts +++ b/src/app/core-ui/side-nav/side-nav.component.ts @@ -55,10 +55,10 @@ export class SideNavComponent implements OnDestroy { ); T: any = T; - PROJECTS_SIDE_NAV = 'PROJECTS_SIDE_NAV'; - TAG_SIDE_NAV = 'TAG_SIDE_NAV'; + readonly PROJECTS_SIDE_NAV: string = 'PROJECTS_SIDE_NAV'; + readonly TAG_SIDE_NAV: string = 'TAG_SIDE_NAV'; activeWorkContextId: string; - WorkContextType = WorkContextType; + WorkContextType: typeof WorkContextType = WorkContextType; private _subs: Subscription = new Subscription(); @@ -125,10 +125,10 @@ export class SideNavComponent implements OnDestroy { this.isTagsExpanded$.next(this.isTagsExpanded); } - addTag() { - } - - switchTag(a, b) { - - } + // addTag() { + // } + // + // switchTag(a, b) { + // + // } } diff --git a/src/app/core-ui/work-context-menu/work-context-menu.component.ts b/src/app/core-ui/work-context-menu/work-context-menu.component.ts index 4af3a78795..4f0ed6491a 100644 --- a/src/app/core-ui/work-context-menu/work-context-menu.component.ts +++ b/src/app/core-ui/work-context-menu/work-context-menu.component.ts @@ -18,7 +18,7 @@ import { Tag } from '../../features/tag/tag.model'; export class WorkContextMenuComponent implements OnDestroy { @Input() contextId: string; T: any = T; - TODAY_TAG_ID = TODAY_TAG.id; + TODAY_TAG_ID: string = TODAY_TAG.id; isForProject: boolean; base: string; private _subs: Subscription = new Subscription(); diff --git a/src/app/core/migration/legacy-persistence.sevice.ts b/src/app/core/migration/legacy-persistence.sevice.ts index f633f34f87..f339bc3bac 100644 --- a/src/app/core/migration/legacy-persistence.sevice.ts +++ b/src/app/core/migration/legacy-persistence.sevice.ts @@ -52,61 +52,61 @@ import { Injectable } from '@angular/core'; export class LegacyPersistenceService { // handled as private but needs to be assigned before the creations - _baseModels = []; - _projectModels = []; + _baseModels: any [] = []; + _projectModels: any [] = []; // TODO auto generate ls keys from appDataKey where possible - project = this._cmBase(LS_PROJECT_META_LIST, 'project', migrateProjectState); - globalConfig = this._cmBase(LS_GLOBAL_CFG, 'globalConfig', migrateGlobalConfigState); - reminders = this._cmBase(LS_REMINDER, 'reminders'); - task = this._cmProject( + project: any = this._cmBase(LS_PROJECT_META_LIST, 'project', migrateProjectState); + globalConfig: any = this._cmBase(LS_GLOBAL_CFG, 'globalConfig', migrateGlobalConfigState); + reminders: any = this._cmBase(LS_REMINDER, 'reminders'); + task: any = this._cmProject( LS_TASK_STATE, 'task', taskReducer, ); - taskRepeatCfg = this._cmProject( + taskRepeatCfg: any = this._cmProject( LS_TASK_REPEAT_CFG_STATE, 'taskRepeatCfg', taskRepeatCfgReducer, ); - taskArchive = this._cmProject( + taskArchive: any = this._cmProject( LS_TASK_ARCHIVE, 'taskArchive', // NOTE: this might be problematic, as we don't really have reducer logic for the archive // TODO add a working reducer for task archive taskReducer, ); - taskAttachment = this._cmProject, TaskAttachment>( + taskAttachment: any = this._cmProject, TaskAttachment>( LS_TASK_ATTACHMENT_STATE, 'taskAttachment', (state) => state ); - bookmark = this._cmProject( + bookmark: any = this._cmProject( LS_BOOKMARK_STATE, 'bookmark', (state) => state, ); - note = this._cmProject( + note: any = this._cmProject( LS_NOTE_STATE, 'note', (state) => state, ); - metric = this._cmProject( + metric: any = this._cmProject( LS_METRIC_STATE, 'metric', (state) => state, ); - improvement = this._cmProject( + improvement: any = this._cmProject( LS_IMPROVEMENT_STATE, 'improvement', (state) => state, ); - obstruction = this._cmProject( + obstruction: any = this._cmProject( LS_OBSTRUCTION_STATE, 'obstruction', (state) => state, ); - private _isBlockSaving = false; + private _isBlockSaving: boolean = false; constructor( private _snackService: SnackService, @@ -305,13 +305,13 @@ export class LegacyPersistenceService { return await Promise.all(promises); } - private _makeProjectKey(projectId, subKey, additional?) { + private _makeProjectKey(projectId: string, subKey: string, additional?: string) { return LS_PROJECT_PREFIX + projectId + '_' + subKey + (additional ? '_' + additional : ''); } // DATA STORAGE INTERFACE // --------------------- - private async _saveToDb(key: string, data: any, isForce = false): Promise { + private async _saveToDb(key: string, data: any, isForce: boolean = false): Promise { if (!this._isBlockSaving || isForce === true) { return this._databaseService.save(key, data); } else { @@ -320,7 +320,7 @@ export class LegacyPersistenceService { } } - private async _removeFromDb(key: string, isForce = false): Promise { + private async _removeFromDb(key: string, isForce: boolean = false): Promise { if (!this._isBlockSaving || isForce === true) { return this._databaseService.remove(key); } else { diff --git a/src/app/features/config/keyboard-input/keyboard-input.component.ts b/src/app/features/config/keyboard-input/keyboard-input.component.ts index 30109070fc..34759b3488 100644 --- a/src/app/features/config/keyboard-input/keyboard-input.component.ts +++ b/src/app/features/config/keyboard-input/keyboard-input.component.ts @@ -15,7 +15,7 @@ export class KeyboardInputComponent extends FieldType { return this.to.type || 'text'; } - onKeyDown(ev) { + onKeyDown(ev: KeyboardEvent) { // the tab key should continue to behave normally if (ev.keyCode === 9 || ev.key === 'Tab') { return; diff --git a/src/app/features/google/google-api.service.ts b/src/app/features/google/google-api.service.ts index 6355be73f6..4238ed50cd 100644 --- a/src/app/features/google/google-api.service.ts +++ b/src/app/features/google/google-api.service.ts @@ -164,7 +164,7 @@ export class GoogleApiService { } } - getFileInfo$(fileId): Observable { + getFileInfo$(fileId: string): Observable { if (!fileId) { this._snackIt('ERROR', T.F.GOOGLE.S_API.ERR_NO_FILE_ID); throwError({[HANDLED_ERROR_PROP_STR]: 'No file id given'}); diff --git a/src/app/features/google/google-drive-sync.service.ts b/src/app/features/google/google-drive-sync.service.ts index 13ce682fb8..6fbf89195d 100644 --- a/src/app/features/google/google-drive-sync.service.ts +++ b/src/app/features/google/google-drive-sync.service.ts @@ -49,7 +49,7 @@ export class GoogleDriveSyncService { ) { } - changeSyncFileName(newFileName): void { + changeSyncFileName(newFileName: string): void { this._store$.dispatch(new ChangeSyncFileName({newFileName})); } diff --git a/src/app/features/google/google-sync-cfg/google-sync-cfg.component.ts b/src/app/features/google/google-sync-cfg/google-sync-cfg.component.ts index 58721deb59..e6cf6528bd 100644 --- a/src/app/features/google/google-sync-cfg/google-sync-cfg.component.ts +++ b/src/app/features/google/google-sync-cfg/google-sync-cfg.component.ts @@ -33,7 +33,7 @@ export class GoogleSyncCfgComponent implements OnInit, OnDestroy { @ViewChild('formRef', {static: true}) formRef: FormGroup; - @Output() save = new EventEmitter(); + @Output() save: EventEmitter = new EventEmitter(); private _subs: Subscription = new Subscription(); @@ -88,7 +88,7 @@ export class GoogleSyncCfgComponent implements OnInit, OnDestroy { this.googleApiService.logout(); } - changeSyncFileName(newSyncFile) { + changeSyncFileName(newSyncFile: string) { this.googleDriveSyncService.changeSyncFileName(newSyncFile); } diff --git a/src/app/features/google/store/google-drive-sync.effects.ts b/src/app/features/google/store/google-drive-sync.effects.ts index 7fe1ffcf42..f2f87955f1 100644 --- a/src/app/features/google/store/google-drive-sync.effects.ts +++ b/src/app/features/google/store/google-drive-sync.effects.ts @@ -56,11 +56,11 @@ import { PersistenceService } from '../../../core/persistence/persistence.servic @Injectable() export class GoogleDriveSyncEffects { - config$ = this._configService.cfg$.pipe(map(cfg => cfg.googleDriveSync)); - isEnabled$ = this.config$.pipe(map(cfg => cfg.isEnabled), distinctUntilChanged()); - isAutoSyncToRemote$ = this.config$.pipe(map(cfg => cfg.isAutoSyncToRemote), distinctUntilChanged()); - syncInterval$ = this.config$.pipe(map(cfg => cfg.syncInterval), distinctUntilChanged()); - isInitialSyncDone = false; + config$: Observable = this._configService.cfg$.pipe(map(cfg => cfg.googleDriveSync)); + isEnabled$: Observable = this.config$.pipe(map(cfg => cfg.isEnabled), distinctUntilChanged()); + isAutoSyncToRemote$: Observable = this.config$.pipe(map(cfg => cfg.isAutoSyncToRemote), distinctUntilChanged()); + syncInterval$: Observable = this.config$.pipe(map(cfg => cfg.syncInterval), distinctUntilChanged()); + isInitialSyncDone: boolean = false; @Effect() triggerSync$: any = this._actions$.pipe( ofType( @@ -409,11 +409,11 @@ export class GoogleDriveSyncEffects { }); } - private _handleErrorForSave$(err): Observable { + private _handleErrorForSave$(err: any): Observable { return of(new SaveToGoogleDriveCancel()); } - private _handleErrorForLoad$(err): Observable { + private _handleErrorForLoad$(err: any): Observable { this._setInitialSyncDone(); return of(new LoadFromGoogleDriveCancel()); } @@ -475,7 +475,7 @@ export class GoogleDriveSyncEffects { } } - private _showAsyncToast(showWhile$: Observable = EMPTY, msg) { + private _showAsyncToast(showWhile$: Observable = EMPTY, msg: string) { this._snackService.open({ type: 'CUSTOM', ico: 'file_upload', @@ -485,7 +485,7 @@ export class GoogleDriveSyncEffects { }); } - private _confirmSaveNewFile$(fileName): Observable { + private _confirmSaveNewFile$(fileName: string): Observable { return this._matDialog.open(DialogConfirmComponent, { restoreFocus: true, data: { @@ -495,7 +495,7 @@ export class GoogleDriveSyncEffects { }).afterClosed(); } - private _confirmUsingExistingFileDialog$(fileName): Observable { + private _confirmUsingExistingFileDialog$(fileName: string): Observable { return this._matDialog.open(DialogConfirmComponent, { restoreFocus: true, data: { @@ -513,7 +513,7 @@ export class GoogleDriveSyncEffects { return this._googleApiService.loadFile$(this._config._backupDocId); } - private async _import(loadRes): Promise { + private async _import(loadRes: any): Promise { const backupData: AppDataComplete = await this._decodeAppDataIfNeeded(loadRes.backup); return from(this._dataImportService.importCompleteSyncData(backupData)) @@ -559,7 +559,7 @@ export class GoogleDriveSyncEffects { return (d1.getTime() > d2.getTime()); } - private _isEqual(strDate1, strDate2): boolean { + private _isEqual(strDate1: string | number, strDate2: string | number): boolean { const d1 = new Date(strDate1); const d2 = new Date(strDate2); return (d1.getTime() === d2.getTime()); diff --git a/src/app/features/google/store/google-drive-sync.reducer.ts b/src/app/features/google/store/google-drive-sync.reducer.ts index 45849176cc..a0e28de0b7 100644 --- a/src/app/features/google/store/google-drive-sync.reducer.ts +++ b/src/app/features/google/store/google-drive-sync.reducer.ts @@ -25,7 +25,7 @@ export const selectIsGoogleDriveSaveInProgress = createSelector( (state) => state.isSaveInProgress, ); -export function reducer(state = initialGoogleDriveState, action: Action): GoogleDriveState { +export function reducer(state: GoogleDriveState = initialGoogleDriveState, action: Action): GoogleDriveState { switch (action.type) { // case GoogleDriveSyncActionTypes.SaveForSync: // return {...state, isSaveInProgress: true}; diff --git a/src/app/features/issue/cache/issue-cache.service.ts b/src/app/features/issue/cache/issue-cache.service.ts index 39be9991aa..efcaebc138 100644 --- a/src/app/features/issue/cache/issue-cache.service.ts +++ b/src/app/features/issue/cache/issue-cache.service.ts @@ -13,7 +13,7 @@ export interface CacheItem { providedIn: 'root', }) export class IssueCacheService { - cache(url: string, requestInit: RequestInit, orgMethod: any, orgArguments: any[], minAlive = 25000): Observable { + cache(url: string, requestInit: RequestInit, orgMethod: any, orgArguments: any[], minAlive: number = 25000): Observable { const cacheId = getCacheId(requestInit, url); if (this._isUseCache(cacheId) && requestInit.method === 'GET') { diff --git a/src/app/features/issue/issue-content/issue-content.component.ts b/src/app/features/issue/issue-content/issue-content.component.ts index bbc6eacae4..ebfd1ee69c 100644 --- a/src/app/features/issue/issue-content/issue-content.component.ts +++ b/src/app/features/issue/issue-content/issue-content.component.ts @@ -12,9 +12,9 @@ import { IssueData } from '../issue.model'; export class IssueContentComponent implements OnInit { @Input() task: TaskWithSubTasks; @Input() issueData: IssueData; - GITLAB_TYPE = GITLAB_TYPE; - GITHUB_TYPE = GITHUB_TYPE; - JIRA_TYPE = JIRA_TYPE; + readonly GITLAB_TYPE: string = GITLAB_TYPE; + readonly GITHUB_TYPE: string = GITHUB_TYPE; + readonly JIRA_TYPE: string = JIRA_TYPE; constructor() { } diff --git a/src/app/features/issue/issue-effect-helper.service.ts b/src/app/features/issue/issue-effect-helper.service.ts index 46fecb3790..90c3c8fbee 100644 --- a/src/app/features/issue/issue-effect-helper.service.ts +++ b/src/app/features/issue/issue-effect-helper.service.ts @@ -12,13 +12,13 @@ import { SyncService } from '../../imex/sync/sync.service'; providedIn: 'root', }) export class IssueEffectHelperService { - pollIssueTaskUpdatesActions$ = this._actions$.pipe( + pollIssueTaskUpdatesActions$: Observable = this._actions$.pipe( ofType( setActiveWorkContext, ProjectActionTypes.UpdateProjectIssueProviderCfg, ) ); - pollToBacklogActions$ = this._actions$.pipe( + pollToBacklogActions$: Observable = this._actions$.pipe( ofType( setActiveWorkContext, ProjectActionTypes.UpdateProjectIssueProviderCfg, diff --git a/src/app/features/issue/issue-header/issue-header.component.ts b/src/app/features/issue/issue-header/issue-header.component.ts index 4d17bb3295..38e2c3196c 100644 --- a/src/app/features/issue/issue-header/issue-header.component.ts +++ b/src/app/features/issue/issue-header/issue-header.component.ts @@ -11,9 +11,9 @@ import { GITHUB_TYPE, GITLAB_TYPE, JIRA_TYPE } from '../issue.const'; export class IssueHeaderComponent implements OnInit { @Input() task: TaskWithSubTasks; - GITLAB_TYPE = GITLAB_TYPE; - GITHUB_TYPE = GITHUB_TYPE; - JIRA_TYPE = JIRA_TYPE; + readonly GITLAB_TYPE: string = GITLAB_TYPE; + readonly GITHUB_TYPE: string = GITHUB_TYPE; + readonly JIRA_TYPE: string = JIRA_TYPE; constructor() { } diff --git a/src/app/features/issue/issue.service.ts b/src/app/features/issue/issue.service.ts index 04032096a8..ea42bc2048 100644 --- a/src/app/features/issue/issue.service.ts +++ b/src/app/features/issue/issue.service.ts @@ -84,8 +84,8 @@ export class IssueService { async refreshIssue( task: Task, - isNotifySuccess = true, - isNotifyNoUpdateRequired = false + isNotifySuccess: boolean = true, + isNotifyNoUpdateRequired: boolean = false ): Promise { if (typeof this.ISSUE_SERVICE_MAP[task.issueType].refreshIssue === 'function') { const update = await this.ISSUE_SERVICE_MAP[task.issueType].refreshIssue(task, isNotifySuccess, isNotifyNoUpdateRequired); @@ -103,7 +103,7 @@ export class IssueService { issueType: IssueProviderKey, issueIdOrData: string | number | IssueDataReduced, projectId: string, - isAddToBacklog = false, + isAddToBacklog: boolean = false, ): Promise { if (this.ISSUE_SERVICE_MAP[issueType].getAddTaskData) { const {issueId, issueData} = (typeof issueIdOrData === 'number' || typeof issueIdOrData === 'string') diff --git a/src/app/features/issue/providers/jira/jira-api.service.ts b/src/app/features/issue/providers/jira/jira-api.service.ts index 1fb4fc58ce..e9dc8ec78f 100644 --- a/src/app/features/issue/providers/jira/jira-api.service.ts +++ b/src/app/features/issue/providers/jira/jira-api.service.ts @@ -66,8 +66,8 @@ interface JiraRequestCfg { }) export class JiraApiService { private _requestsLog: { [key: string]: JiraRequestLogItem } = {}; - private _isBlockAccess = loadFromSessionStorage(BLOCK_ACCESS_KEY); - private _isExtension = false; + private _isBlockAccess: boolean = loadFromSessionStorage(BLOCK_ACCESS_KEY); + private _isExtension: boolean = false; private _isInterfacesReadyIfNeeded$: Observable = IS_ELECTRON ? of(true).pipe() : this._chromeExtensionInterfaceService.onReady$.pipe( @@ -157,15 +157,15 @@ export class JiraApiService { }, cfg); } - getIssueById$(issueId, cfg: JiraCfg): Observable { + getIssueById$(issueId: string, cfg: JiraCfg): Observable { return this._getIssueById$(issueId, cfg, true); } - getReducedIssueById$(issueId, cfg: JiraCfg): Observable { + getReducedIssueById$(issueId: string, cfg: JiraCfg): Observable { return this._getIssueById$(issueId, cfg, false); } - getCurrentUser$(cfg: JiraCfg, isForce = false): Observable { + getCurrentUser$(cfg: JiraCfg, isForce: boolean = false): Observable { return this._sendRequest$({ pathname: `myself`, transform: mapResponse, @@ -239,7 +239,7 @@ export class JiraApiService { }, cfg); } - private _getIssueById$(issueId, cfg: JiraCfg, isGetChangelog = false): Observable { + private _getIssueById$(issueId: string, cfg: JiraCfg, isGetChangelog: boolean = false): Observable { return this._sendRequest$({ transform: mapIssueResponse, pathname: `issue/${issueId}`, @@ -257,7 +257,7 @@ export class JiraApiService { && (IS_ELECTRON || this._isExtension); } - private _sendRequest$(jiraReqCfg: JiraRequestCfg, cfg: JiraCfg, isForce = false): Observable { + private _sendRequest$(jiraReqCfg: JiraRequestCfg, cfg: JiraCfg, isForce: boolean = false): Observable { return this._isInterfacesReadyIfNeeded$.pipe( take(1), concatMap(() => { @@ -314,7 +314,7 @@ export class JiraApiService { })); } - private _sendRequestToExecutor$(requestId: string, url: string, requestInit: RequestInit, transform, jiraCfg: JiraCfg): Observable { + private _sendRequestToExecutor$(requestId: string, url: string, requestInit: RequestInit, transform: any, jiraCfg: JiraCfg): Observable { // TODO refactor to observable for request canceling etc let promiseResolve; let promiseReject; @@ -377,8 +377,8 @@ export class JiraApiService { transform, jiraCfg }: { - promiseResolve, - promiseReject, + promiseResolve: any, + promiseReject: any, requestId: string, requestInit: RequestInit, transform: any, @@ -406,7 +406,7 @@ export class JiraApiService { }; } - private _handleResponse(res) { + private _handleResponse(res: any) { // check if proper id is given in callback and if exists in requestLog if (res.requestId && this._requestsLog[res.requestId]) { const currentRequest = this._requestsLog[res.requestId]; @@ -446,7 +446,7 @@ export class JiraApiService { saveToSessionStorage(BLOCK_ACCESS_KEY, true); } - private _b64EncodeUnicode(str) { + private _b64EncodeUnicode(str: string) { if (typeof btoa === 'function') { return btoa(str); } diff --git a/src/app/features/issue/providers/jira/jira-common-interfaces.service.ts b/src/app/features/issue/providers/jira/jira-common-interfaces.service.ts index cd9d569eb1..b339827bfd 100644 --- a/src/app/features/issue/providers/jira/jira-common-interfaces.service.ts +++ b/src/app/features/issue/providers/jira/jira-common-interfaces.service.ts @@ -44,8 +44,8 @@ export class JiraCommonInterfacesService implements IssueServiceInterface { async refreshIssue( task: Task, - isNotifySuccess = true, - isNotifyNoUpdateRequired = false + isNotifySuccess: boolean = true, + isNotifyNoUpdateRequired: boolean = false ): Promise<{ taskChanges: Partial, issue: JiraIssue }> { const cfg = await this._getCfgOnce$(task.projectId).toPromise(); const issue = await this._jiraApiService.getIssueById$(task.issueId, cfg).toPromise() as JiraIssue; diff --git a/src/app/features/issue/providers/jira/jira-issue/jira-issue-content/jira-issue-content.component.ts b/src/app/features/issue/providers/jira/jira-issue/jira-issue-content/jira-issue-content.component.ts index 097ab2716c..ec93f5fa40 100644 --- a/src/app/features/issue/providers/jira/jira-issue/jira-issue-content/jira-issue-content.component.ts +++ b/src/app/features/issue/providers/jira/jira-issue/jira-issue-content/jira-issue-content.component.ts @@ -7,7 +7,7 @@ import { T } from '../../../../../../t.const'; import { TaskService } from '../../../../../tasks/task.service'; import * as j2m from 'jira2md'; import { JiraCommonInterfacesService } from '../../jira-common-interfaces.service'; -import { ReplaySubject } from 'rxjs'; +import { Observable, ReplaySubject } from 'rxjs'; import { switchMap } from 'rxjs/operators'; @Component({ @@ -23,8 +23,8 @@ export class JiraIssueContentComponent { T: any = T; issue: JiraIssue; task: TaskWithSubTasks; - private _task$ = new ReplaySubject(1); - issueUrl$ = this._task$.pipe( + private _task$: ReplaySubject = new ReplaySubject(1); + issueUrl$: Observable = this._task$.pipe( switchMap((task) => this._jiraCommonInterfacesService.issueLink$(task.issueId, task.projectId)) ); diff --git a/src/app/features/issue/providers/jira/jira-issue/jira-issue-header/jira-issue-header.component.ts b/src/app/features/issue/providers/jira/jira-issue/jira-issue-header/jira-issue-header.component.ts index 15c743b9cf..76464ef307 100644 --- a/src/app/features/issue/providers/jira/jira-issue/jira-issue-header/jira-issue-header.component.ts +++ b/src/app/features/issue/providers/jira/jira-issue/jira-issue-header/jira-issue-header.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { TaskWithSubTasks } from '../../../../../tasks/task.model'; import { isOnline$ } from 'src/app/util/is-online'; +import { Observable } from 'rxjs'; @Component({ selector: 'jira-issue-header', @@ -10,7 +11,7 @@ import { isOnline$ } from 'src/app/util/is-online'; }) export class JiraIssueHeaderComponent { @Input() public task: TaskWithSubTasks; - isOnline$ = isOnline$; + isOnline$: Observable = isOnline$; constructor() { } diff --git a/src/app/features/issue/providers/jira/jira-issue/jira-issue.effects.ts b/src/app/features/issue/providers/jira/jira-issue/jira-issue.effects.ts index 44b2b24e37..8424061e08 100644 --- a/src/app/features/issue/providers/jira/jira-issue/jira-issue.effects.ts +++ b/src/app/features/issue/providers/jira/jira-issue/jira-issue.effects.ts @@ -202,7 +202,8 @@ export class JiraIssueEffects { ); // HOOKS - private _isInitialRequestForProjectDone$ = new BehaviorSubject(false); + private _isInitialRequestForProjectDone$: BehaviorSubject = new BehaviorSubject(false); + @Effect({dispatch: false}) checkConnection$: Observable = this._actions$.pipe( ofType(setActiveWorkContext), diff --git a/src/app/features/issue/providers/jira/jira-view-components/jira-cfg-stepper/jira-cfg-stepper.component.ts b/src/app/features/issue/providers/jira/jira-view-components/jira-cfg-stepper/jira-cfg-stepper.component.ts index e8bd56f577..79e3287d8b 100644 --- a/src/app/features/issue/providers/jira/jira-view-components/jira-cfg-stepper/jira-cfg-stepper.component.ts +++ b/src/app/features/issue/providers/jira/jira-view-components/jira-cfg-stepper/jira-cfg-stepper.component.ts @@ -28,14 +28,14 @@ import { HANDLED_ERROR_PROP_STR, HelperClasses } from '../../../../../../app.con }) export class JiraCfgStepperComponent implements OnDestroy { T: any = T; - HelperClasses = HelperClasses; + HelperClasses: typeof HelperClasses = HelperClasses; credentialsFormGroup: FormGroup = new FormGroup({}); credentialsFormConfig: FormlyFieldConfig[] = []; advancedSettingsFormGroup: FormGroup = new FormGroup({}); advancedSettingsFormConfig: FormlyFieldConfig[] = []; - isTestCredentialsSuccess = false; + isTestCredentialsSuccess: boolean = false; user: JiraOriginalUser; jiraCfg: JiraCfg = Object.assign({}, DEFAULT_JIRA_CFG, {isEnabled: true}); @Output() saveCfg: EventEmitter = new EventEmitter(); diff --git a/src/app/features/issue/providers/jira/jira-view-components/jira-cfg/jira-cfg.component.ts b/src/app/features/issue/providers/jira/jira-view-components/jira-cfg/jira-cfg.component.ts index 8ee330be7f..18c892fedc 100644 --- a/src/app/features/issue/providers/jira/jira-view-components/jira-cfg/jira-cfg.component.ts +++ b/src/app/features/issue/providers/jira/jira-view-components/jira-cfg/jira-cfg.component.ts @@ -30,12 +30,12 @@ export class JiraCfgComponent implements OnInit, OnDestroy { @Input() section: ConfigFormSection; @Output() save: EventEmitter<{ sectionKey: GlobalConfigSectionKey | ProjectCfgFormKey, config: any }> = new EventEmitter(); T: any = T; - HelperClasses = HelperClasses; + HelperClasses: typeof HelperClasses = HelperClasses; issueSuggestionsCtrl: FormControl = new FormControl(); customFieldSuggestionsCtrl: FormControl = new FormControl(); customFields: any [] = []; customFieldsPromise: Promise; - isLoading$ = new BehaviorSubject(false); + isLoading$: BehaviorSubject = new BehaviorSubject(false); fields: FormlyFieldConfig[]; form: FormGroup = new FormGroup({}); options: FormlyFormOptions = {}; @@ -115,7 +115,7 @@ export class JiraCfgComponent implements OnInit, OnDestroy { this._subs.unsubscribe(); } - toggleEnabled(isEnabled) { + toggleEnabled(isEnabled: boolean) { if (this._workContextService.activeWorkContextType !== WorkContextType.PROJECT) { throw new Error('Should only be called when in project context'); } diff --git a/src/app/features/metric/improvement/improvement.service.ts b/src/app/features/metric/improvement/improvement.service.ts index c5e6c10feb..c3539dc231 100644 --- a/src/app/features/metric/improvement/improvement.service.ts +++ b/src/app/features/metric/improvement/improvement.service.ts @@ -61,7 +61,7 @@ export class ImprovementService { return id; } - addCheckedDay(id: string, checkedDay = getWorklogStr()) { + addCheckedDay(id: string, checkedDay: string = getWorklogStr()) { this._store$.dispatch(new AddImprovementCheckedDay({ id, checkedDay, diff --git a/src/app/features/metric/improvement/store/improvement.reducer.ts b/src/app/features/metric/improvement/store/improvement.reducer.ts index c01103f718..ed1470b1c7 100644 --- a/src/app/features/metric/improvement/store/improvement.reducer.ts +++ b/src/app/features/metric/improvement/store/improvement.reducer.ts @@ -1,5 +1,16 @@ import { createEntityAdapter, EntityAdapter } from '@ngrx/entity'; -import { ImprovementActions, ImprovementActionTypes } from './improvement.actions'; +import { + AddImprovement, + AddImprovementCheckedDay, + DeleteImprovement, + DisableImprovementRepeat, + HideImprovement, + ImprovementActions, + ImprovementActionTypes, + LoadImprovementState, + ToggleImprovementRepeat, + UpdateImprovement +} from './improvement.actions'; import { Improvement, ImprovementState } from '../improvement.model'; import { createFeatureSelector, createSelector } from '@ngrx/store'; import { getWorklogStr } from '../../../../util/get-work-log-str'; @@ -34,41 +45,41 @@ export const initialImprovementState: ImprovementState = adapter.getInitialState }); export function improvementReducer( - state = initialImprovementState, + state: ImprovementState = initialImprovementState, action: ImprovementActions ): ImprovementState { switch (action.type) { case ImprovementActionTypes.AddImprovement: { - return adapter.addOne(action.payload.improvement, state); + return adapter.addOne((action as AddImprovement).payload.improvement, state); } case ImprovementActionTypes.UpdateImprovement: { - return adapter.updateOne(action.payload.improvement, state); + return adapter.updateOne((action as UpdateImprovement).payload.improvement, state); } case ImprovementActionTypes.DeleteImprovement: { - return adapter.removeOne(action.payload.id, state); + return adapter.removeOne((action as DeleteImprovement).payload.id, state); } // case ImprovementActionTypes.DeleteImprovements: { - // return adapter.removeMany(action.payload.ids, state); + // return adapter.removeMany((action as AddImprovement).payload.ids, state); // } case ImprovementActionTypes.LoadImprovementState: - return {...action.payload.state}; + return {...(action as LoadImprovementState).payload.state}; case ImprovementActionTypes.HideImprovement: const items = state.hiddenImprovementBannerItems || []; return { ...state, hideDay: getWorklogStr(), - hiddenImprovementBannerItems: [...items, action.payload.id] + hiddenImprovementBannerItems: [...items, (action as HideImprovement).payload.id] }; case ImprovementActionTypes.ToggleImprovementRepeat: - const itemI = state.entities[action.payload.id]; + const itemI = state.entities[(action as ToggleImprovementRepeat).payload.id]; return adapter.updateOne({ - id: action.payload.id, + id: (action as ToggleImprovementRepeat).payload.id, changes: { isRepeat: !itemI.isRepeat }, @@ -76,7 +87,7 @@ export function improvementReducer( case ImprovementActionTypes.DisableImprovementRepeat: return adapter.updateOne({ - id: action.payload.id, + id: (action as DisableImprovementRepeat).payload.id, changes: { isRepeat: false }, @@ -89,7 +100,7 @@ export function improvementReducer( }; case ImprovementActionTypes.AddImprovementCheckedDay: { - const {id, checkedDay} = action.payload; + const {id, checkedDay} = (action as AddImprovementCheckedDay).payload; const allCheckedDays = state.entities[id].checkedDays || []; return (allCheckedDays.includes(checkedDay) && checkedDay) diff --git a/src/app/features/metric/obstruction/store/obstruction.reducer.ts b/src/app/features/metric/obstruction/store/obstruction.reducer.ts index 1396271e08..d5d444aa1d 100644 --- a/src/app/features/metric/obstruction/store/obstruction.reducer.ts +++ b/src/app/features/metric/obstruction/store/obstruction.reducer.ts @@ -1,5 +1,13 @@ import { createEntityAdapter, EntityAdapter } from '@ngrx/entity'; -import { ObstructionActions, ObstructionActionTypes } from './obstruction.actions'; +import { + AddObstruction, + DeleteObstruction, + DeleteObstructions, + LoadObstructionState, + ObstructionActions, + ObstructionActionTypes, + UpdateObstruction +} from './obstruction.actions'; import { Obstruction, ObstructionState } from '../obstruction.model'; import { createFeatureSelector, createSelector } from '@ngrx/store'; @@ -16,28 +24,28 @@ export const initialObstructionState: ObstructionState = adapter.getInitialState }); export function obstructionReducer( - state = initialObstructionState, + state: ObstructionState = initialObstructionState, action: ObstructionActions ): ObstructionState { switch (action.type) { case ObstructionActionTypes.AddObstruction: { - return adapter.addOne(action.payload.obstruction, state); + return adapter.addOne((action as AddObstruction).payload.obstruction, state); } case ObstructionActionTypes.UpdateObstruction: { - return adapter.updateOne(action.payload.obstruction, state); + return adapter.updateOne((action as UpdateObstruction).payload.obstruction, state); } case ObstructionActionTypes.DeleteObstruction: { - return adapter.removeOne(action.payload.id, state); + return adapter.removeOne((action as DeleteObstruction).payload.id, state); } case ObstructionActionTypes.DeleteObstructions: { - return adapter.removeMany(action.payload.ids, state); + return adapter.removeMany((action as DeleteObstructions).payload.ids, state); } case ObstructionActionTypes.LoadObstructionState: - return {...action.payload.state}; + return {...(action as LoadObstructionState).payload.state}; default: { return state; diff --git a/src/app/features/note/note.service.ts b/src/app/features/note/note.service.ts index 842a5672a4..f00ff0e331 100644 --- a/src/app/features/note/note.service.ts +++ b/src/app/features/note/note.service.ts @@ -40,7 +40,7 @@ export class NoteService { return await this._persistenceService.note.ent.getById(projectId, id); } - public async loadStateForProject(projectId) { + public async loadStateForProject(projectId: string) { const notes = await this._persistenceService.note.load(projectId) || initialNoteState; this.loadState(notes); } @@ -49,7 +49,7 @@ export class NoteService { this._store$.dispatch(loadNoteState({state})); } - public add(note: Partial = {}, remindAt: number = null, isPreventFocus = false) { + public add(note: Partial = {}, remindAt: number = null, isPreventFocus: boolean = false) { const id = shortid(); this._store$.dispatch(addNote({ @@ -69,7 +69,7 @@ export class NoteService { this._store$.dispatch(deleteNote({id})); } - public update(id, note: Partial) { + public update(id: string, note: Partial) { this._store$.dispatch(updateNote({ note: { id, @@ -78,7 +78,7 @@ export class NoteService { })); } - public async updateFromDifferentWorkContext(workContextId, id, updates: Partial) { + public async updateFromDifferentWorkContext(workContextId: string, id: string, updates: Partial) { const noteState = await this._persistenceService.note.load(workContextId); const noteToUpdate = noteState.entities[id]; if (noteToUpdate) { @@ -107,18 +107,19 @@ export class NoteService { this._store$.dispatch(removeNoteReminder({id: noteId, reminderId})); } - createFromDrop(ev) { + createFromDrop(ev: DragEvent) { this._handleInput(createFromDrop(ev), ev); } - private async _handleInput(drop: DropPasteInput, ev) { + private async _handleInput(drop: DropPasteInput, ev: Event) { // properly not intentional so we leave if (!drop || !drop.path || drop.type === 'FILE') { return; } // don't intervene with text inputs - if (ev.target.tagName === 'INPUT' || ev.target.tagName === 'TEXTAREA') { + const target = ev.target as HTMLElement; + if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') { return; } diff --git a/src/app/features/note/notes/notes.component.ts b/src/app/features/note/notes/notes.component.ts index 3e88197286..62030fd9cd 100644 --- a/src/app/features/note/notes/notes.component.ts +++ b/src/app/features/note/notes/notes.component.ts @@ -28,11 +28,11 @@ import { T } from '../../../t.const'; }) export class NotesComponent implements OnInit, OnDestroy { - @Output() scrollToSidenav = new EventEmitter(); + @Output() scrollToSidenav: EventEmitter = new EventEmitter(); T: any = T; - isElementWasAdded = false; - isDragOver = false; + isElementWasAdded: boolean = false; + isDragOver: boolean = false; dragEnterTarget: HTMLElement; @ViewChild('buttonEl', {static: true}) buttonEl: MatButton; diff --git a/src/app/features/note/store/note.reducer.ts b/src/app/features/note/store/note.reducer.ts index dcf584a1f6..752f157c4b 100644 --- a/src/app/features/note/store/note.reducer.ts +++ b/src/app/features/note/store/note.reducer.ts @@ -78,7 +78,7 @@ const _reducer = createReducer( ); export function noteReducer( - state = initialNoteState, + state: NoteState = initialNoteState, action: Action ): NoteState { return _reducer(state, action); diff --git a/src/app/features/planning-mode/planning-mode.service.ts b/src/app/features/planning-mode/planning-mode.service.ts index 2ff08bb3eb..099b9928ba 100644 --- a/src/app/features/planning-mode/planning-mode.service.ts +++ b/src/app/features/planning-mode/planning-mode.service.ts @@ -6,8 +6,8 @@ import { WorkContextService } from '../work-context/work-context.service'; @Injectable({providedIn: 'root'}) export class PlanningModeService { private _iPlanningModeEndedUser$: BehaviorSubject = new BehaviorSubject(false); - private _manualTriggerCheck$ = new BehaviorSubject(null); - private _triggerCheck$ = merge( + private _manualTriggerCheck$: BehaviorSubject = new BehaviorSubject(null); + private _triggerCheck$: Observable = merge( this._manualTriggerCheck$, // TODO fix hacky way of waiting for data to be loaded this._workContextService.onWorkContextChange$.pipe(delay(100)) diff --git a/src/app/features/pomodoro/pomodoro.service.ts b/src/app/features/pomodoro/pomodoro.service.ts index 3401c0c5f8..eb9e429988 100644 --- a/src/app/features/pomodoro/pomodoro.service.ts +++ b/src/app/features/pomodoro/pomodoro.service.ts @@ -150,7 +150,7 @@ export class PomodoroService { this._store$.dispatch(new StartPomodoro()); } - pause(isBreakEndPause = false) { + pause(isBreakEndPause: boolean = false) { this._store$.dispatch(new PausePomodoro({isBreakEndPause})); } diff --git a/src/app/features/pomodoro/store/pomodoro.effects.ts b/src/app/features/pomodoro/store/pomodoro.effects.ts index c5e1738898..33f7e1e459 100644 --- a/src/app/features/pomodoro/store/pomodoro.effects.ts +++ b/src/app/features/pomodoro/store/pomodoro.effects.ts @@ -30,7 +30,7 @@ export class PomodoroEffects { currentTaskId$: Observable = this._store$.pipe(select(selectCurrentTaskId)); @Effect() - playPauseOnCurrentUpdate$ = this._actions$.pipe( + playPauseOnCurrentUpdate$: Observable = this._actions$.pipe( ofType( TaskActionTypes.SetCurrentTask, TaskActionTypes.UnsetCurrentTask, @@ -65,7 +65,7 @@ export class PomodoroEffects { ); @Effect() - autoStartNextOnSessionStartIfNotAlready$ = this._actions$.pipe( + autoStartNextOnSessionStartIfNotAlready$: Observable = this._actions$.pipe( ofType( PomodoroActionTypes.FinishPomodoroSession, PomodoroActionTypes.SkipPomodoroBreak, @@ -83,13 +83,13 @@ export class PomodoroEffects { ); @Effect() - stopPomodoro$ = this._actions$.pipe( + stopPomodoro$: Observable = this._actions$.pipe( ofType(PomodoroActionTypes.StopPomodoro), mapTo(new UnsetCurrentTask()), ); @Effect() - pauseTimeTrackingIfOptionEnabled$ = this._actions$.pipe( + pauseTimeTrackingIfOptionEnabled$: Observable = this._actions$.pipe( ofType(PomodoroActionTypes.FinishPomodoroSession), withLatestFrom( this._pomodoroService.cfg$, @@ -102,7 +102,7 @@ export class PomodoroEffects { ); @Effect({dispatch: false}) - playSessionDoneSoundIfEnabled$ = this._actions$.pipe( + playSessionDoneSoundIfEnabled$: Observable = this._actions$.pipe( ofType( PomodoroActionTypes.PausePomodoro, PomodoroActionTypes.FinishPomodoroSession, @@ -123,7 +123,7 @@ export class PomodoroEffects { ); @Effect() - pauseTimeTrackingForPause$ = this._actions$.pipe( + pauseTimeTrackingForPause$: Observable = this._actions$.pipe( ofType(PomodoroActionTypes.PausePomodoro), withLatestFrom( this._pomodoroService.cfg$, @@ -135,7 +135,7 @@ export class PomodoroEffects { ); @Effect({dispatch: false}) - openBreakDialog = this._actions$.pipe( + openBreakDialog: Observable = this._actions$.pipe( ofType(PomodoroActionTypes.FinishPomodoroSession), withLatestFrom( this._pomodoroService.isBreak$, @@ -148,7 +148,7 @@ export class PomodoroEffects { ); @Effect({dispatch: false}) - sessionStartSnack$ = this._actions$.pipe( + sessionStartSnack$: Observable = this._actions$.pipe( ofType( PomodoroActionTypes.FinishPomodoroSession, PomodoroActionTypes.SkipPomodoroBreak, @@ -179,7 +179,7 @@ export class PomodoroEffects { ); @Effect({dispatch: false}) - setTaskBarIconProgress$: any = this._pomodoroService.sessionProgress$.pipe( + setTaskBarIconProgress$: Observable = this._pomodoroService.sessionProgress$.pipe( filter(() => IS_ELECTRON), withLatestFrom(this._pomodoroService.cfg$), // we display pomodoro progress for pomodoro diff --git a/src/app/features/pomodoro/store/pomodoro.reducer.ts b/src/app/features/pomodoro/store/pomodoro.reducer.ts index 240ceb9ecd..c7fa318b0a 100644 --- a/src/app/features/pomodoro/store/pomodoro.reducer.ts +++ b/src/app/features/pomodoro/store/pomodoro.reducer.ts @@ -21,7 +21,7 @@ export const selectIsManualPause = createSelector(selectPomodoroFeatureState, st export const selectIsBreak = createSelector(selectPomodoroFeatureState, state => state.isBreak); export const selectCurrentCycle = createSelector(selectPomodoroFeatureState, state => state.currentCycle); -export function pomodoroReducer(state = initialPomodoroState, action: PomodoroActions): PomodoroState { +export function pomodoroReducer(state: PomodoroState = initialPomodoroState, action: PomodoroActions): PomodoroState { switch (action.type) { case PomodoroActionTypes.StartPomodoro: { diff --git a/src/app/features/project/project.service.ts b/src/app/features/project/project.service.ts index a93f97a0d8..e90e6743ab 100644 --- a/src/app/features/project/project.service.ts +++ b/src/app/features/project/project.service.ts @@ -153,7 +153,7 @@ export class ProjectService { }); } - remove(projectId) { + remove(projectId: string) { this._store$.dispatch({ type: ProjectActionTypes.DeleteProject, payload: {id: projectId} @@ -176,7 +176,7 @@ export class ProjectService { projectId: string, issueProviderKey: IssueProviderKey, providerCfg: Partial, - isOverwrite = false + isOverwrite: boolean = false ) { this._store$.dispatch({ type: ProjectActionTypes.UpdateProjectIssueProviderCfg, diff --git a/src/app/features/project/store/project.effects.ts b/src/app/features/project/store/project.effects.ts index b8f121e264..f1cbe38a6c 100644 --- a/src/app/features/project/store/project.effects.ts +++ b/src/app/features/project/store/project.effects.ts @@ -61,18 +61,18 @@ import { TaskArchive, TaskState } from '../../tasks/task.model'; import { unique } from '../../../util/unique'; import { TaskRepeatCfgService } from '../../task-repeat-cfg/task-repeat-cfg.service'; import { TODAY_TAG } from '../../tag/tag.const'; -import { EMPTY, of } from 'rxjs'; +import { EMPTY, Observable, of } from 'rxjs'; @Injectable() export class ProjectEffects { - saveToLs$ = this._store$.pipe( + saveToLs$: Observable = this._store$.pipe( // tap(() => console.log('SAVE')), select(selectProjectFeatureState), take(1), switchMap((projectState) => this._persistenceService.project.saveState(projectState)), ); @Effect({dispatch: false}) - syncProjectToLs$: any = this._actions$ + syncProjectToLs$: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.AddProject, @@ -107,7 +107,7 @@ export class ProjectEffects { switchMap(() => this.saveToLs$), ); @Effect({dispatch: false}) - updateProjectStorageConditionalTask$ = this._actions$.pipe( + updateProjectStorageConditionalTask$: Observable = this._actions$.pipe( ofType( TaskActionTypes.AddTask, TaskActionTypes.DeleteTask, @@ -141,7 +141,7 @@ export class ProjectEffects { switchMap(() => this.saveToLs$), ); @Effect({dispatch: false}) - updateProjectStorageConditional$ = this._actions$.pipe( + updateProjectStorageConditional$: Observable = this._actions$.pipe( ofType( moveTaskInTodayList, moveTaskUpInTodayList, @@ -167,7 +167,7 @@ export class ProjectEffects { ); @Effect() - updateWorkEnd$: any = this._actions$ + updateWorkEnd$: Observable = this._actions$ .pipe( ofType(TaskActionTypes.AddTimeSpent), filter((action: AddTimeSpent) => !!action.payload.task.projectId), @@ -181,7 +181,7 @@ export class ProjectEffects { ); @Effect() - onProjectIdChange$: any = this._actions$ + onProjectIdChange$: Observable = this._actions$ .pipe( ofType( setActiveWorkContext @@ -204,7 +204,7 @@ export class ProjectEffects { // TODO a solution for orphaned tasks might be needed @Effect({dispatch: false}) - deleteProjectRelatedData: any = this._actions$ + deleteProjectRelatedData: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.DeleteProject, @@ -225,7 +225,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - archiveProject: any = this._actions$ + archiveProject: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.ArchiveProject, @@ -241,7 +241,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - unarchiveProject: any = this._actions$ + unarchiveProject: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.UnarchiveProject, @@ -259,7 +259,7 @@ export class ProjectEffects { // PURE SNACKS // ----------- @Effect({dispatch: false}) - snackUpdateIssueProvider$: any = this._actions$ + snackUpdateIssueProvider$: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.UpdateProjectIssueProviderCfg, @@ -276,7 +276,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - snackUpdateBaseSettings$: any = this._actions$ + snackUpdateBaseSettings$: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.UpdateProject, @@ -290,7 +290,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - onProjectCreatedSnack: any = this._actions$ + onProjectCreatedSnack: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.AddProject, @@ -306,7 +306,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - showDeletionSnack: any = this._actions$ + showDeletionSnack: Observable = this._actions$ .pipe( ofType( ProjectActionTypes.DeleteProject, @@ -320,7 +320,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - cleanupTaskListOfNonProjectTasks: any = this._workContextService.activeWorkContextTypeAndId$ + cleanupTaskListOfNonProjectTasks: Observable = this._workContextService.activeWorkContextTypeAndId$ .pipe( filter(({activeType}) => activeType === WorkContextType.PROJECT), delay(100), @@ -349,7 +349,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - cleanupBacklogOfNonProjectTasks: any = this._workContextService.activeWorkContextTypeAndId$ + cleanupBacklogOfNonProjectTasks: Observable = this._workContextService.activeWorkContextTypeAndId$ .pipe( filter(({activeType}) => activeType === WorkContextType.PROJECT), delay(100), @@ -378,7 +378,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - cleanupNullTasksForTaskList: any = this._workContextService.activeWorkContextTypeAndId$ + cleanupNullTasksForTaskList: Observable = this._workContextService.activeWorkContextTypeAndId$ .pipe( // only run in prod, because we want to debug this // filter(() => environment.production), @@ -407,7 +407,7 @@ export class ProjectEffects { ); @Effect({dispatch: false}) - cleanupNullTasksForBacklog: any = this._workContextService.activeWorkContextTypeAndId$ + cleanupNullTasksForBacklog: Observable = this._workContextService.activeWorkContextTypeAndId$ .pipe( // only run in prod, because we want to debug this // filter(() => environment.production), @@ -436,7 +436,7 @@ export class ProjectEffects { ); @Effect() - moveToTodayListOnAddTodayTag: any = this._actions$.pipe( + moveToTodayListOnAddTodayTag: Observable = this._actions$.pipe( ofType(TaskActionTypes.UpdateTaskTags), filter((action: UpdateTaskTags) => action.payload.task.projectId && @@ -457,7 +457,7 @@ export class ProjectEffects { ); // @Effect() - // moveToBacklogOnRemoveTodayTag: any = this._actions$.pipe( + // moveToBacklogOnRemoveTodayTag: Observable = this._actions$.pipe( // ofType(TaskActionTypes.UpdateTaskTags), // filter((action: UpdateTaskTags) => // action.payload.task.projectId && diff --git a/src/app/features/reminder/reminder.module.ts b/src/app/features/reminder/reminder.module.ts index e0cfa5b8b4..5b6d2a5e3a 100644 --- a/src/app/features/reminder/reminder.module.ts +++ b/src/app/features/reminder/reminder.module.ts @@ -24,7 +24,7 @@ import { DataInitService } from '../../core/data-init/data-init.service'; ], }) export class ReminderModule { - private _throttledShowNotification = throttle(60000, this._showNotification.bind(this)); + private _throttledShowNotification: any = throttle(60000, this._showNotification.bind(this)); constructor( private readonly _reminderService: ReminderService, diff --git a/src/app/features/simple-counter/simple-counter-button/simple-counter-button.component.ts b/src/app/features/simple-counter/simple-counter-button/simple-counter-button.component.ts index bb0d31f650..28e317f819 100644 --- a/src/app/features/simple-counter/simple-counter-button/simple-counter-button.component.ts +++ b/src/app/features/simple-counter/simple-counter-button/simple-counter-button.component.ts @@ -14,8 +14,8 @@ import { getWorklogStr } from '../../../util/get-work-log-str'; }) export class SimpleCounterButtonComponent { T: any = T; - SimpleCounterType = SimpleCounterType; - todayStr = getWorklogStr(); + SimpleCounterType: typeof SimpleCounterType = SimpleCounterType; + todayStr: string = getWorklogStr(); @Input() simpleCounter: SimpleCounter; @@ -37,7 +37,7 @@ export class SimpleCounterButtonComponent { this._simpleCounterService.setCounterToday(this.simpleCounter.id, 0); } - edit(ev?) { + edit(ev?: Event) { if (ev) { ev.preventDefault(); } diff --git a/src/app/features/simple-counter/store/simple-counter.effects.ts b/src/app/features/simple-counter/store/simple-counter.effects.ts index f2e618e551..d1c9142cc8 100644 --- a/src/app/features/simple-counter/store/simple-counter.effects.ts +++ b/src/app/features/simple-counter/store/simple-counter.effects.ts @@ -19,7 +19,7 @@ import { selectSimpleCounterFeatureState } from './simple-counter.reducer'; import { SimpleCounterState, SimpleCounterType } from '../simple-counter.model'; import { TimeTrackingService } from '../../time-tracking/time-tracking.service'; import { SimpleCounterService } from '../simple-counter.service'; -import { EMPTY, of } from 'rxjs'; +import { EMPTY, Observable, of } from 'rxjs'; import { SIMPLE_COUNTER_TRIGGER_ACTIONS } from '../simple-counter.const'; import { T } from '../../../t.const'; import { SnackService } from '../../../core/snack/snack.service'; @@ -29,7 +29,7 @@ import { ImexMetaService } from '../../../imex/imex-meta/imex-meta.service'; @Injectable() export class SimpleCounterEffects { - updateSimpleCountersStorage$ = createEffect(() => this._actions$.pipe( + updateSimpleCountersStorage$: Observable = createEffect(() => this._actions$.pipe( ofType( updateAllSimpleCounters, setSimpleCounterCounterToday, @@ -51,7 +51,7 @@ export class SimpleCounterEffects { tap(([, featureState]) => this._saveToLs(featureState)), ), {dispatch: false}); - checkTimedCounters$ = createEffect(() => this._simpleCounterService.enabledAndToggledSimpleCounters$.pipe( + checkTimedCounters$: Observable = createEffect(() => this._simpleCounterService.enabledAndToggledSimpleCounters$.pipe( switchMap((items) => (items && items.length) ? this._timeTrackingService.tick$.pipe( map(tick => ({tick, items})) @@ -66,7 +66,7 @@ export class SimpleCounterEffects { ), )); - actionListeners$ = createEffect(() => this._simpleCounterService.enabledSimpleCountersUpdatedOnCfgChange$.pipe( + actionListeners$: Observable = createEffect(() => this._simpleCounterService.enabledSimpleCountersUpdatedOnCfgChange$.pipe( map(items => items && items.filter(item => (item.triggerOnActions && item.triggerOnActions.length) || (item.triggerOffActions && item.triggerOffActions.length) @@ -111,7 +111,7 @@ export class SimpleCounterEffects { ), )); - successSnack$ = createEffect(() => this._actions$.pipe( + successSnack$: Observable = createEffect(() => this._actions$.pipe( ofType(updateAllSimpleCounters), tap(() => this._snackService.open({ type: 'SUCCESS', diff --git a/src/app/features/tag/store/tag.effects.ts b/src/app/features/tag/store/tag.effects.ts index 1e7350fa53..c34b9abb53 100644 --- a/src/app/features/tag/store/tag.effects.ts +++ b/src/app/features/tag/store/tag.effects.ts @@ -30,7 +30,7 @@ import { } from '../../tasks/store/task.actions'; import { TagService } from '../tag.service'; import { TaskService } from '../../tasks/task.service'; -import { EMPTY, of } from 'rxjs'; +import { EMPTY, Observable, of } from 'rxjs'; import { Task, TaskArchive } from '../../tasks/task.model'; import { Tag } from '../tag.model'; import { getWorklogStr } from '../../../util/get-work-log-str'; @@ -48,13 +48,13 @@ import { @Injectable() export class TagEffects { - saveToLs$ = this._store$.pipe( + saveToLs$: Observable = this._store$.pipe( select(selectTagFeatureState), take(1), switchMap((tagState) => this._persistenceService.tag.saveState(tagState)), tap(this._updateLastLocalSyncModelChange.bind(this)), ); - updateTagsStorage$ = createEffect(() => this._actions$.pipe( + updateTagsStorage$: Observable = createEffect(() => this._actions$.pipe( ofType( addTag, updateTag, @@ -72,7 +72,7 @@ export class TagEffects { ), switchMap(() => this.saveToLs$), ), {dispatch: false}); - updateProjectStorageConditionalTask$ = createEffect(() => this._actions$.pipe( + updateProjectStorageConditionalTask$: Observable = createEffect(() => this._actions$.pipe( ofType( TaskActionTypes.AddTask, TaskActionTypes.DeleteTask, @@ -101,7 +101,7 @@ export class TagEffects { }), switchMap(() => this.saveToLs$), ), {dispatch: false}); - updateTagsStorageConditional$ = createEffect(() => this._actions$.pipe( + updateTagsStorageConditional$: Observable = createEffect(() => this._actions$.pipe( ofType( moveTaskInTodayList, moveTaskUpInTodayList, @@ -141,7 +141,7 @@ export class TagEffects { ); @Effect() - updateWorkEnd$: any = this._actions$.pipe( + updateWorkEnd$: Observable = this._actions$.pipe( ofType(TaskActionTypes.AddTimeSpent), concatMap(({payload}: AddTimeSpent) => payload.task.parentId ? this._taskService.getByIdOnce$(payload.task.parentId).pipe(first()) @@ -160,7 +160,7 @@ export class TagEffects { ); @Effect({dispatch: false}) - deleteTagRelatedData: any = this._actions$.pipe( + deleteTagRelatedData: Observable = this._actions$.pipe( ofType( deleteTag, deleteTags, @@ -190,7 +190,7 @@ export class TagEffects { ); @Effect({dispatch: false}) - redirectIfCurrentTagIsDeleted: any = this._actions$.pipe( + redirectIfCurrentTagIsDeleted: Observable = this._actions$.pipe( ofType( deleteTag, deleteTags, @@ -204,7 +204,7 @@ export class TagEffects { ); @Effect({dispatch: false}) - cleanupNullTasksForTaskList: any = this._workContextService.activeWorkContextTypeAndId$.pipe( + cleanupNullTasksForTaskList: Observable = this._workContextService.activeWorkContextTypeAndId$.pipe( filter(({activeType}) => activeType === WorkContextType.TAG), switchMap(({activeType, activeId}) => this._workContextService.todaysTasks$.pipe( take(1), diff --git a/src/app/features/tag/store/tag.reducer.ts b/src/app/features/tag/store/tag.reducer.ts index 2a5b33b130..301ef055df 100644 --- a/src/app/features/tag/store/tag.reducer.ts +++ b/src/app/features/tag/store/tag.reducer.ts @@ -43,7 +43,7 @@ export const selectTagById = createSelector( ); export const selectTagsByIds = createSelector( selectTagFeatureState, - (state, props: { ids }) => props.ids ? props.ids.map( + (state: TagState, props: { ids: string[] }) => props.ids ? props.ids.map( id => state.entities[id]) : [] ); export const selectTagByName = createSelector( @@ -196,7 +196,7 @@ const _reducer = createReducer( ); export function tagReducer( - state = initialTagState, + state: TagState = initialTagState, action: Action, ): TagState { switch (action.type) { diff --git a/src/app/features/tag/tag/tag.component.ts b/src/app/features/tag/tag/tag.component.ts index 7309315a46..fea3eb7c26 100644 --- a/src/app/features/tag/tag/tag.component.ts +++ b/src/app/features/tag/tag/tag.component.ts @@ -16,7 +16,7 @@ export interface TagComponentTag { export class TagComponent { tag: TagComponentTag; // @HostBinding('style.background') - color; + color: string; constructor() { } diff --git a/src/app/features/task-repeat-cfg/store/task-repeat-cfg.effects.ts b/src/app/features/task-repeat-cfg/store/task-repeat-cfg.effects.ts index ddad8fcdf6..8a48ed9d4e 100644 --- a/src/app/features/task-repeat-cfg/store/task-repeat-cfg.effects.ts +++ b/src/app/features/task-repeat-cfg/store/task-repeat-cfg.effects.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { concatMap, filter, flatMap, map, take, tap, withLatestFrom } from 'rxjs/operators'; -import { select, Store } from '@ngrx/store'; +import { Action, select, Store } from '@ngrx/store'; import { AddTaskRepeatCfgToTask, DeleteTaskRepeatCfg, @@ -14,7 +14,7 @@ import { Task, TaskArchive, TaskWithSubTasks } from '../../tasks/task.model'; import { AddTask, MoveToArchive, RemoveTaskReminder, UpdateTask } from '../../tasks/store/task.actions'; import { TaskService } from '../../tasks/task.service'; import { TaskRepeatCfgService } from '../task-repeat-cfg.service'; -import { TASK_REPEAT_WEEKDAY_MAP, TaskRepeatCfg } from '../task-repeat-cfg.model'; +import { TASK_REPEAT_WEEKDAY_MAP, TaskRepeatCfg, TaskRepeatCfgState } from '../task-repeat-cfg.model'; import { from } from 'rxjs'; import { isToday } from '../../../util/is-today.util'; import { WorkContextService } from '../../work-context/work-context.service'; @@ -156,7 +156,7 @@ export class TaskRepeatCfgEffects { ) { } - private _saveToLs([action, taskRepeatCfgState]) { + private _saveToLs([action, taskRepeatCfgState]: [Action, TaskRepeatCfgState]) { this._persistenceService.updateLastLocalSyncModelChange(); this._persistenceService.taskRepeatCfg.saveState(taskRepeatCfgState); } diff --git a/src/app/features/task-repeat-cfg/store/task-repeat-cfg.reducer.ts b/src/app/features/task-repeat-cfg/store/task-repeat-cfg.reducer.ts index 2a89a9825d..772a48c15b 100644 --- a/src/app/features/task-repeat-cfg/store/task-repeat-cfg.reducer.ts +++ b/src/app/features/task-repeat-cfg/store/task-repeat-cfg.reducer.ts @@ -22,7 +22,7 @@ export const initialTaskRepeatCfgState: TaskRepeatCfgState = adapter.getInitialS }); export function taskRepeatCfgReducer( - state = initialTaskRepeatCfgState, + state: TaskRepeatCfgState = initialTaskRepeatCfgState, action: TaskRepeatCfgActions ): TaskRepeatCfgState { diff --git a/src/app/features/tasks/pipes/sub-task-total-time-estimate.pipe.ts b/src/app/features/tasks/pipes/sub-task-total-time-estimate.pipe.ts index c666e5e24d..481294431c 100644 --- a/src/app/features/tasks/pipes/sub-task-total-time-estimate.pipe.ts +++ b/src/app/features/tasks/pipes/sub-task-total-time-estimate.pipe.ts @@ -5,7 +5,7 @@ import { Task } from '../task.model'; name: 'subTaskTotalTimeEstimate' }) export class SubTaskTotalTimeEstimatePipe implements PipeTransform { - transform = getSubTasksTotalTimeEstimate; + transform: (value: any, ...args: any[]) => any = getSubTasksTotalTimeEstimate; } export const getSubTasksTotalTimeEstimate = (subTasks: Task[]): number => { diff --git a/src/app/features/tasks/pipes/sub-task-total-time-spent.pipe.ts b/src/app/features/tasks/pipes/sub-task-total-time-spent.pipe.ts index eae6c43eff..df5768a18a 100644 --- a/src/app/features/tasks/pipes/sub-task-total-time-spent.pipe.ts +++ b/src/app/features/tasks/pipes/sub-task-total-time-spent.pipe.ts @@ -5,7 +5,7 @@ import { Task } from '../task.model'; name: 'subTaskTotalTimeSpent' }) export class SubTaskTotalTimeSpentPipe implements PipeTransform { - transform = getSubTasksTotalTimeSpent; + transform: (value: any, ...args: any[]) => any = getSubTasksTotalTimeSpent; } export const getSubTasksTotalTimeSpent = (subTasks: Task[]): number => { diff --git a/src/app/features/tasks/select-task/select-task.component.ts b/src/app/features/tasks/select-task/select-task.component.ts index 5f0cd428de..8ce6dbf2b7 100644 --- a/src/app/features/tasks/select-task/select-task.component.ts +++ b/src/app/features/tasks/select-task/select-task.component.ts @@ -16,8 +16,8 @@ export class SelectTaskComponent implements OnInit, OnDestroy { T: any = T; taskSelectCtrl: FormControl = new FormControl(); filteredTasks: Task[]; - isCreate = false; - @Output() taskChange = new EventEmitter(); + isCreate: boolean = false; + @Output() taskChange: EventEmitter = new EventEmitter(); private _destroy$: Subject = new Subject(); constructor( diff --git a/src/app/features/tasks/store/task-internal.effects.ts b/src/app/features/tasks/store/task-internal.effects.ts index 1e130feb52..1dd591b8a8 100644 --- a/src/app/features/tasks/store/task-internal.effects.ts +++ b/src/app/features/tasks/store/task-internal.effects.ts @@ -125,7 +125,7 @@ export class TaskInternalEffects { ) { } - private _findNextTask(state: TaskState, todaysTaskIds: string[], oldCurrentId?): string { + private _findNextTask(state: TaskState, todaysTaskIds: string[], oldCurrentId?: string): string { let nextId = null; const {entities} = state; diff --git a/src/app/features/tasks/store/task-ui.effects.ts b/src/app/features/tasks/store/task-ui.effects.ts index 00869d0c9d..721d4785e7 100644 --- a/src/app/features/tasks/store/task-ui.effects.ts +++ b/src/app/features/tasks/store/task-ui.effects.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { AddTask, DeleteTask, TaskActionTypes } from './task.actions'; -import { select, Store } from '@ngrx/store'; +import { Action, select, Store } from '@ngrx/store'; import { tap, throttleTime, withLatestFrom } from 'rxjs/operators'; import { selectCurrentTask } from './task.selectors'; import { NotifyService } from '../../../core/notify/notify.service'; @@ -13,6 +13,7 @@ import { BannerId } from '../../../core/banner/banner.model'; import { T } from '../../../t.const'; import { SnackService } from '../../../core/snack/snack.service'; import { Router } from '@angular/router'; +import { GlobalConfigState } from '../../config/global-config.model'; @Injectable() export class TaskUiEffects { @@ -75,7 +76,7 @@ export class TaskUiEffects { ) { } - private _notifyAboutTimeEstimateExceeded([action, ct, globalCfg]) { + private _notifyAboutTimeEstimateExceeded([action, ct, globalCfg]: [Action, any, GlobalConfigState]) { if (globalCfg && globalCfg.misc.isNotifyWhenTimeEstimateExceeded && ct && ct.timeEstimate > 0 && ct.timeSpent > ct.timeEstimate) { diff --git a/src/app/features/tasks/store/task.selectors.ts b/src/app/features/tasks/store/task.selectors.ts index 7320a60db4..d0295c002f 100644 --- a/src/app/features/tasks/store/task.selectors.ts +++ b/src/app/features/tasks/store/task.selectors.ts @@ -117,8 +117,9 @@ export const selectTaskById = createSelector( export const selectTasksById = createSelector( selectTaskFeatureState, - (state, props: { ids }) => props.ids ? props.ids.map( - id => state.entities[id]) : [] + (state, props: { ids: string[] }) => props.ids + ? props.ids.map(id => state.entities[id]) + : [] ); export const selectTasksWithSubTasksByIds = createSelector( diff --git a/src/app/features/tasks/task-additional-info/task-additional-info-item/task-additional-info-item.component.ts b/src/app/features/tasks/task-additional-info/task-additional-info-item/task-additional-info-item.component.ts index 96a820d899..13c2c87a5b 100644 --- a/src/app/features/tasks/task-additional-info/task-additional-info-item/task-additional-info-item.component.ts +++ b/src/app/features/tasks/task-additional-info/task-additional-info-item/task-additional-info-item.component.ts @@ -20,11 +20,11 @@ export class TaskAdditionalInfoItemComponent { @Input() expanded: boolean; @Input() inputIcon: string; - @Output() collapseParent = new EventEmitter(); - @Output() keyPress = new EventEmitter(); - @Output() editActionTriggered = new EventEmitter(); + @Output() collapseParent: EventEmitter = new EventEmitter(); + @Output() keyPress: EventEmitter = new EventEmitter(); + @Output() editActionTriggered: EventEmitter = new EventEmitter(); - @HostBinding('tabindex') tabindex = 3; + @HostBinding('tabindex') readonly tabindex: number = 3; constructor( public elementRef: ElementRef diff --git a/src/app/features/tasks/task-additional-info/task-additional-info-wrapper/task-additional-info-wrapper.component.ts b/src/app/features/tasks/task-additional-info/task-additional-info-wrapper/task-additional-info-wrapper.component.ts index c3b0193236..9fc8a3e0f0 100644 --- a/src/app/features/tasks/task-additional-info/task-additional-info-wrapper/task-additional-info-wrapper.component.ts +++ b/src/app/features/tasks/task-additional-info/task-additional-info-wrapper/task-additional-info-wrapper.component.ts @@ -2,7 +2,8 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { TaskService } from '../../task.service'; import { LayoutService } from '../../../../core-ui/layout/layout.service'; import { delay, switchMap } from 'rxjs/operators'; -import { of } from 'rxjs'; +import { Observable, of } from 'rxjs'; +import { Task, TaskWithSubTasks } from '../../task.model'; @Component({ selector: 'task-additional-info-wrapper', @@ -12,10 +13,10 @@ import { of } from 'rxjs'; }) export class TaskAdditionalInfoWrapperComponent { // NOTE: used for debugging - @Input() isAlwaysOver = false; + @Input() isAlwaysOver: boolean = false; // to still display its data when panel is closing - selectedTaskWithDelayForNone$ = this.taskService.selectedTask$.pipe( + selectedTaskWithDelayForNone$: Observable = this.taskService.selectedTask$.pipe( switchMap((task) => task ? of(task) : of(null).pipe(delay(200)) diff --git a/src/app/features/tasks/task-additional-info/task-additional-info.component.ts b/src/app/features/tasks/task-additional-info/task-additional-info.component.ts index d4f3b24305..d25093c4c6 100644 --- a/src/app/features/tasks/task-additional-info/task-additional-info.component.ts +++ b/src/app/features/tasks/task-additional-info/task-additional-info.component.ts @@ -54,17 +54,17 @@ import { LayoutService } from '../../../core-ui/layout/layout.service'; }) export class TaskAdditionalInfoComponent implements AfterViewInit, OnDestroy { - @HostBinding('@noop') alwaysTrue = true; + @HostBinding('@noop') alwaysTrue: boolean = true; @ViewChildren(TaskAdditionalInfoItemComponent) itemEls: QueryList; @ViewChild('attachmentPanelElRef') attachmentPanelElRef: TaskAdditionalInfoItemComponent; - ShowSubTasksMode = ShowSubTasksMode; - selectedItemIndex = 0; - isFocusNotes = false; + ShowSubTasksMode: typeof ShowSubTasksMode = ShowSubTasksMode; + selectedItemIndex: number = 0; + isFocusNotes: boolean = false; T: any = T; issueAttachments: TaskAttachment[]; - reminderId$ = new BehaviorSubject(null); + reminderId$: BehaviorSubject = new BehaviorSubject(null); reminderData$: Observable = this.reminderId$.pipe( switchMap(id => id ? this._reminderService.getById$(id) @@ -72,19 +72,19 @@ export class TaskAdditionalInfoComponent implements AfterViewInit, OnDestroy { ), ); - issueIdAndType$ = new Subject<{ id: string | number; type: IssueProviderKey }>(); - issueIdAndTypeShared$ = this.issueIdAndType$.pipe( + issueIdAndType$: Subject<{ id: string | number; type: IssueProviderKey }> = new Subject(); + issueIdAndTypeShared$: Observable<{ id: string | number; type: IssueProviderKey }> = this.issueIdAndType$.pipe( shareReplay(1), ); - issueDataNullTrigger$ = new Subject<{ id: string | number; type: IssueProviderKey }>(); + issueDataNullTrigger$: Subject<{ id: string | number; type: IssueProviderKey }> = new Subject(); issueDataTrigger$: Observable<{ id: string | number; type: IssueProviderKey }> = merge( this.issueIdAndTypeShared$, this.issueDataNullTrigger$ ); issueData: IssueData; - repeatCfgId$ = new BehaviorSubject(null); + repeatCfgId$: BehaviorSubject = new BehaviorSubject(null); repeatCfgDays$: Observable = this.repeatCfgId$.pipe( switchMap(id => (id) ? this._taskRepeatCfgService.getTaskRepeatCfgById$(id).pipe( @@ -108,13 +108,6 @@ export class TaskAdditionalInfoComponent implements AfterViewInit, OnDestroy { switchMap((id) => id ? this.taskService.getByIdWithSubTaskData$(id) : of(null)) ); localAttachments: TaskAttachment[]; - issueAttachments$: Observable = this.issueData$.pipe( - withLatestFrom(this.issueIdAndTypeShared$), - map(([data, {type}]) => (data && type) - ? this._issueService.getMappedAttachments(type, data) - : []) - ); - private _taskData: TaskWithSubTasks; issueData$: Observable = this.issueDataTrigger$.pipe( switchMap((args) => (args && args.id && args.type) ? this._issueService.getById$(args.type, args.id, this._taskData.projectId) @@ -132,6 +125,14 @@ export class TaskAdditionalInfoComponent implements AfterViewInit, OnDestroy { // expandable closed when the data is loaded delay(0), ); + issueAttachments$: Observable = this.issueData$.pipe( + withLatestFrom(this.issueIdAndTypeShared$), + map(([data, {type}]) => (data && type) + ? this._issueService.getMappedAttachments(type, data) + : []) + ); + private _taskData: TaskWithSubTasks; + private _focusTimeout: number; private _subs: Subscription = new Subscription(); @@ -303,7 +304,7 @@ export class TaskAdditionalInfoComponent implements AfterViewInit, OnDestroy { } } - focusItem(cmpInstance: TaskAdditionalInfoItemComponent, timeoutDuration = 150) { + focusItem(cmpInstance: TaskAdditionalInfoItemComponent, timeoutDuration: number = 150) { window.clearTimeout(this._focusTimeout); this._focusTimeout = window.setTimeout(() => { const i = this.itemEls.toArray().findIndex(el => el === cmpInstance); diff --git a/src/app/features/tasks/task-attachment/task-attachment-link/task-attachment-link.directive.ts b/src/app/features/tasks/task-attachment/task-attachment-link/task-attachment-link.directive.ts index 65c5e71986..20ac4a5cd5 100644 --- a/src/app/features/tasks/task-attachment/task-attachment-link/task-attachment-link.directive.ts +++ b/src/app/features/tasks/task-attachment/task-attachment-link/task-attachment-link.directive.ts @@ -44,7 +44,7 @@ export class TaskAttachmentLinkDirective { } } - private _openExternalUrl(rawUrl) { + private _openExternalUrl(rawUrl: string) { if (!rawUrl) { return; } @@ -62,7 +62,7 @@ export class TaskAttachmentLinkDirective { } } - private _exec(command) { + private _exec(command: string) { this._electronService.ipcRenderer.send(IPC.EXEC, command); } } diff --git a/src/app/features/tasks/task-attachment/task-attachment-list/task-attachment-list.component.ts b/src/app/features/tasks/task-attachment/task-attachment-list/task-attachment-list.component.ts index e9ed850dc0..578e5bf8a4 100644 --- a/src/app/features/tasks/task-attachment/task-attachment-list/task-attachment-list.component.ts +++ b/src/app/features/tasks/task-attachment/task-attachment-list/task-attachment-list.component.ts @@ -16,7 +16,7 @@ import { T } from '../../../../t.const'; export class TaskAttachmentListComponent implements OnInit { @Input() taskId: string; @Input() attachments: TaskAttachment[]; - @Input() isDisableControls = false; + @Input() isDisableControls: boolean = false; T: any = T; isError: boolean[] = []; @@ -52,7 +52,7 @@ export class TaskAttachmentListComponent implements OnInit { }); } - remove(id) { + remove(id: string) { this.attachmentService.deleteAttachment(this.taskId, id); } diff --git a/src/app/features/tasks/task-attachment/task-attachment.service.ts b/src/app/features/tasks/task-attachment/task-attachment.service.ts index 692405add7..21f53b5e58 100644 --- a/src/app/features/tasks/task-attachment/task-attachment.service.ts +++ b/src/app/features/tasks/task-attachment/task-attachment.service.ts @@ -47,7 +47,7 @@ export class TaskAttachmentService { // HANDLE INPUT // ------------ - createFromDrop(ev, taskId: string) { + createFromDrop(ev: DragEvent, taskId: string) { this._handleInput(createFromDrop(ev), ev, taskId); } @@ -55,14 +55,15 @@ export class TaskAttachmentService { // this._handleInput(createFromPaste(ev), ev, taskId); // } - private _handleInput(attachment: DropPasteInput, ev, taskId) { + private _handleInput(attachment: DropPasteInput, ev: Event, taskId: string) { // properly not intentional so we leave if (!attachment || !attachment.path) { return; } // don't intervene with text inputs - if (ev.target.tagName === 'INPUT' || ev.target.tagName === 'TEXTAREA') { + const targetEl = ev.target as HTMLElement; + if (targetEl.tagName === 'INPUT' || targetEl.tagName === 'TEXTAREA') { return; } diff --git a/src/app/features/tasks/task-list/task-list.component.ts b/src/app/features/tasks/task-list/task-list.component.ts index b6c1b2a235..f78a66468d 100644 --- a/src/app/features/tasks/task-list/task-list.component.ts +++ b/src/app/features/tasks/task-list/task-list.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, + ElementRef, Input, OnDestroy, OnInit, @@ -40,11 +41,11 @@ export class TaskListComponent implements OnDestroy, OnInit { @Input() noTasksMsg: string; @Input() isBacklog: boolean; listId: string; - @ViewChild('listEl', {static: true}) listEl; - isBlockAni = false; - doneTasksLength = 0; - undoneTasksLength = 0; - allTasksLength = 0; + @ViewChild('listEl', {static: true}) listEl: ElementRef; + isBlockAni: boolean = false; + doneTasksLength: number = 0; + undoneTasksLength: number = 0; + allTasksLength: number = 0; currentTaskId: string; private _subs: Subscription = new Subscription(); private _blockAnimationTimeout: number; diff --git a/src/app/features/tasks/task-summary-table/task-summary-table.component.ts b/src/app/features/tasks/task-summary-table/task-summary-table.component.ts index 9e19cb9a2c..090ddfe1a3 100644 --- a/src/app/features/tasks/task-summary-table/task-summary-table.component.ts +++ b/src/app/features/tasks/task-summary-table/task-summary-table.component.ts @@ -13,7 +13,7 @@ import { T } from '../../../t.const'; export class TaskSummaryTableComponent { @Input() flatTasks: Task[]; @Input() day: string = getWorklogStr(); - @Output() updated = new EventEmitter(); + @Output() updated: EventEmitter = new EventEmitter(); T: any = T; diff --git a/src/app/features/tasks/task.service.ts b/src/app/features/tasks/task.service.ts index 6133ad665c..092c24aa4c 100644 --- a/src/app/features/tasks/task.service.ts +++ b/src/app/features/tasks/task.service.ts @@ -54,7 +54,6 @@ import { selectCurrentTaskParentOrCurrent, selectIsTaskDataLoaded, selectMainTasksWithoutTag, - selectScheduledTasks, selectSelectedTask, selectSelectedTaskId, selectTaskAdditionalInfoTargetPanel, @@ -141,10 +140,6 @@ export class TaskService { select(selectAllRepeatableTaskWithSubTasksFlat), ); - scheduledTasksWOData$ = this._store.pipe( - select(selectScheduledTasks), - ); - isTaskDataLoaded$: Observable = this._store.pipe( select(selectIsTaskDataLoaded), ); @@ -203,7 +198,7 @@ export class TaskService { } } - setSelectedId(id: string, taskAdditionalInfoTargetPanel = TaskAdditionalInfoTargetPanel.Default) { + setSelectedId(id: string, taskAdditionalInfoTargetPanel: TaskAdditionalInfoTargetPanel = TaskAdditionalInfoTargetPanel.Default) { this._store.dispatch(new SetSelectedTask({id, taskAdditionalInfoTargetPanel})); } @@ -222,9 +217,9 @@ export class TaskService { // Tasks // ----- add(title: string, - isAddToBacklog = false, + isAddToBacklog: boolean = false, additional: Partial = {}, - isAddToBottom = false, + isAddToBottom: boolean = false, ): string { const workContextId = this._workContextService.activeWorkContextId; const workContextType = this._workContextService.activeWorkContextType; @@ -360,7 +355,7 @@ export class TaskService { } } - addSubTaskTo(parentId) { + addSubTaskTo(parentId: string) { this._store.dispatch(new AddSubTask({ task: this.createNewTaskWithDefaults({title: ''}), parentId @@ -391,7 +386,7 @@ export class TaskService { } } - moveToToday(id, isMoveToTop = false) { + moveToToday(id: string, isMoveToTop: boolean = false) { const workContextId = this._workContextService.activeWorkContextId; const workContextType = this._workContextService.activeWorkContextType; if (workContextType === WorkContextType.PROJECT) { @@ -399,7 +394,7 @@ export class TaskService { } } - moveToBacklog(id) { + moveToBacklog(id: string) { const workContextId = this._workContextService.activeWorkContextId; const workContextType = this._workContextService.activeWorkContextType; if (workContextType === WorkContextType.PROJECT) { @@ -429,7 +424,7 @@ export class TaskService { this._store.dispatch(new RestoreTask({task, subTasks})); } - roundTimeSpentForDay(day: string, taskIds: string[], roundTo: RoundTimeOption, isRoundUp = false) { + roundTimeSpentForDay(day: string, taskIds: string[], roundTo: RoundTimeOption, isRoundUp: boolean = false) { this._store.dispatch(new RoundTimeSpentForDay({day, taskIds, roundTo, isRoundUp})); } @@ -475,7 +470,7 @@ export class TaskService { // REMINDER // -------- - addReminder(task: Task | TaskWithSubTasks, remindAt: number, isMoveToBacklog = false) { + addReminder(task: Task | TaskWithSubTasks, remindAt: number, isMoveToBacklog: boolean = false) { this._store.dispatch(new AddTaskReminder({task, remindAt, isMoveToBacklog})); } @@ -533,7 +528,7 @@ export class TaskService { this.updateUi(id, {_showSubTasksMode: ShowSubTasksMode.Show}); } - toggleSubTaskMode(taskId: string, isShowLess = true, isEndless = false) { + toggleSubTaskMode(taskId: string, isShowLess: boolean = true, isEndless: boolean = false) { this._store.dispatch(new ToggleTaskShowSubTasks({taskId, isShowLess, isEndless})); } diff --git a/src/app/features/tasks/task/task.component.ts b/src/app/features/tasks/task/task.component.ts index bc9428c496..2aeee8aa2e 100644 --- a/src/app/features/tasks/task/task.component.ts +++ b/src/app/features/tasks/task/task.component.ts @@ -52,14 +52,14 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { T: any = T; isDragOver: boolean; isTouchOnly: boolean = IS_TOUCH_ONLY; - isLockPanLeft = false; - isLockPanRight = false; - isPreventPointerEventsWhilePanning = false; - isActionTriggered = false; - ShowSubTasksMode = ShowSubTasksMode; - contextMenuPosition = {x: '0px', y: '0px'}; + isLockPanLeft: boolean = false; + isLockPanRight: boolean = false; + isPreventPointerEventsWhilePanning: boolean = false; + isActionTriggered: boolean = false; + ShowSubTasksMode: typeof ShowSubTasksMode = ShowSubTasksMode; + contextMenuPosition: { x: string; y: string } = {x: '0px', y: '0px'}; progress: number; - isDev = !environment.production; + isDev: boolean = !environment.production; @ViewChild('contentEditableOnClickEl', {static: true}) contentEditableOnClickEl: ElementRef; @ViewChild('blockLeftEl') blockLeftElRef: ElementRef; @ViewChild('blockRightEl') blockRightElRef: ElementRef; @@ -67,14 +67,14 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { // only works because item comes first in dom @ViewChild('contextMenuTriggerEl', {static: true, read: MatMenuTrigger}) contextMenu: MatMenuTrigger; @ViewChild('projectMenuTriggerEl', {static: false, read: MatMenuTrigger}) projectMenuTrigger: MatMenuTrigger; - @HostBinding('tabindex') tabIndex = 1; + @HostBinding('tabindex') tabIndex: number = 1; @HostBinding('class.isDone') isDone: boolean; @HostBinding('id') taskIdWithPrefix: string; // @see ngOnInit @HostBinding('class.isCurrent') isCurrent: boolean; @HostBinding('class.isSelected') isSelected: boolean; - TODAY_TAG_ID = TODAY_TAG.id; - private _task$ = new ReplaySubject(1); + TODAY_TAG_ID: string = TODAY_TAG.id; + private _task$: ReplaySubject = new ReplaySubject(1); issueUrl$: Observable = this._task$.pipe( switchMap((v) => { return (v.issueType && v.issueId && v.projectId) @@ -139,14 +139,14 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { // }); // } - @HostListener('dragenter', ['$event']) onDragEnter(ev: Event) { + @HostListener('dragenter', ['$event']) onDragEnter(ev: DragEvent) { this._dragEnterTarget = ev.target as HTMLElement; ev.preventDefault(); ev.stopPropagation(); this.isDragOver = true; } - @HostListener('dragleave', ['$event']) onDragLeave(ev: Event) { + @HostListener('dragleave', ['$event']) onDragLeave(ev: DragEvent) { if (this._dragEnterTarget === (ev.target as HTMLElement)) { ev.preventDefault(); ev.stopPropagation(); @@ -154,7 +154,7 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { } } - @HostListener('drop', ['$event']) onDrop(ev: Event) { + @HostListener('drop', ['$event']) onDrop(ev: DragEvent) { this._attachmentService.createFromDrop(ev, this.task.id); ev.stopPropagation(); this.isDragOver = false; @@ -339,7 +339,7 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { this.onTagsUpdated(this.task.tagIds.filter(tagId => tagId !== TODAY_TAG.id)); } - focusPrevious(isFocusReverseIfNotPossible = false) { + focusPrevious(isFocusReverseIfNotPossible: boolean = false) { const taskEls = Array.from(document.querySelectorAll('task')); const currentIndex = taskEls.findIndex(el => document.activeElement === el); const prevEl = taskEls[currentIndex - 1] as HTMLElement; @@ -358,7 +358,7 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { } - focusNext(isFocusReverseIfNotPossible = false) { + focusNext(isFocusReverseIfNotPossible: boolean = false) { const taskEls = Array.from(document.querySelectorAll('task')); const currentIndex = taskEls.findIndex(el => document.activeElement === el); const nextEl = taskEls[currentIndex + 1] as HTMLElement; @@ -403,14 +403,15 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { this._taskService.updateTags(this.task, tagIds, this.task.tagIds); } - onPanStart(ev) { + onPanStart(ev: any) { if (!IS_TOUCH_ONLY) { return; } this._resetAfterPan(); + const targetEl: HTMLElement = ev.target as HTMLElement; if ( - (ev.target.className.indexOf && ev.target.className.indexOf('drag-handle') > -1) + (targetEl.className.indexOf && targetEl.className.indexOf('drag-handle') > -1) || Math.abs(ev.deltaY) > Math.abs(ev.deltaX) || document.activeElement === this.contentEditableOnClickEl.nativeElement || ev.isFinal @@ -473,11 +474,11 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { } } - onPanLeft(ev) { + onPanLeft(ev: any) { this._handlePan(ev); } - onPanRight(ev) { + onPanRight(ev: any) { this._handlePan(ev); } @@ -497,7 +498,7 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit { return project.id; } - private _handlePan(ev) { + private _handlePan(ev: any) { if (!IS_TOUCH_ONLY || !this.isLockPanLeft && !this.isLockPanRight || ev.eventType === 8) { diff --git a/src/app/features/time-tracking/idle.service.ts b/src/app/features/time-tracking/idle.service.ts index 171768e90c..9c7b2d5c87 100644 --- a/src/app/features/time-tracking/idle.service.ts +++ b/src/app/features/time-tracking/idle.service.ts @@ -21,7 +21,7 @@ const IDLE_POLL_INTERVAL = 1000; providedIn: 'root', }) export class IdleService { - isIdle = false; + isIdle: boolean = false; private _isIdle$: BehaviorSubject = new BehaviorSubject(false); isIdle$: Observable = this._isIdle$.asObservable().pipe( distinctUntilChanged(), @@ -30,11 +30,11 @@ export class IdleService { private _idleTime$: BehaviorSubject = new BehaviorSubject(0); idleTime$: Observable = this._idleTime$.asObservable(); - private _triggerResetBreakTimer$ = new Subject(); + private _triggerResetBreakTimer$: Subject = new Subject(); triggerResetBreakTimer$: Observable = this._triggerResetBreakTimer$.asObservable(); private lastCurrentTaskId: string; - private isIdleDialogOpen = false; + private isIdleDialogOpen: boolean = false; private idlePollInterval: number; constructor( @@ -65,7 +65,7 @@ export class IdleService { // }, 700); } - handleIdle(idleTime) { + handleIdle(idleTime: number) { console.log('IDLE_TIME', idleTime, new Date()); const cfg = this._configService.cfg.idle; const minIdleTime = cfg.minIdleTime || DEFAULT_MIN_IDLE_TIME; @@ -137,7 +137,7 @@ export class IdleService { } } - initIdlePoll(initialIdleTime) { + initIdlePoll(initialIdleTime: number) { const idleStart = Date.now(); this._idleTime$.next(initialIdleTime); this.idlePollInterval = window.setInterval(() => { diff --git a/src/app/features/time-tracking/take-a-break/take-a-break.service.ts b/src/app/features/time-tracking/take-a-break/take-a-break.service.ts index 6fd3fd2a41..d73781afec 100644 --- a/src/app/features/time-tracking/take-a-break/take-a-break.service.ts +++ b/src/app/features/time-tracking/take-a-break/take-a-break.service.ts @@ -79,7 +79,7 @@ export class TakeABreakService { map(tick => tick.duration), ); - private _triggerSnooze$ = new Subject(); + private _triggerSnooze$: Subject = new Subject(); private _snoozeActive$: Observable = this._triggerSnooze$.pipe( startWith(false), switchMap((val: boolean | number) => { @@ -102,7 +102,7 @@ export class TakeABreakService { }), ); - private _triggerManualReset$ = new Subject(); + private _triggerManualReset$: Subject = new Subject(); private _triggerReset$: Observable = merge( this._triggerProgrammaticReset$, @@ -125,8 +125,8 @@ export class TakeABreakService { shareReplay(1), ); - private _triggerLockScreenCounter$ = new Subject(); - private _triggerLockScreenThrottledAndDelayed$ = this._triggerLockScreenCounter$.pipe( + private _triggerLockScreenCounter$: Subject = new Subject(); + private _triggerLockScreenThrottledAndDelayed$: Observable = this._triggerLockScreenCounter$.pipe( filter(() => IS_ELECTRON), distinctUntilChanged(), switchMap((v) => !!(v) @@ -222,7 +222,7 @@ export class TakeABreakService { }); } - snooze(snoozeTime = 15 * 60 * 1000) { + snooze(snoozeTime: number = 15 * 60 * 1000) { this._triggerSnooze$.next(snoozeTime); this._triggerLockScreenCounter$.next(false); } diff --git a/src/app/features/ui-helper/ui-helper.service.ts b/src/app/features/ui-helper/ui-helper.service.ts index 285dc5ccaf..33ae23da94 100644 --- a/src/app/features/ui-helper/ui-helper.service.ts +++ b/src/app/features/ui-helper/ui-helper.service.ts @@ -9,10 +9,11 @@ import { IPC } from '../../../../electron/ipc-events.const'; import { IS_ELECTRON } from '../../app.constants'; import { fromEvent } from 'rxjs'; import { throttleTime } from 'rxjs/operators'; +import { webFrame } from 'electron'; @Injectable({providedIn: 'root'}) export class UiHelperService { - private _webFrame = this._electronService.webFrame; + private _webFrame: typeof webFrame = this._electronService.webFrame; constructor( @Inject(DOCUMENT) private _document: Document, diff --git a/src/app/features/work-context/store/work-context.effects.ts b/src/app/features/work-context/store/work-context.effects.ts index fbb0cd0597..74f922dc5c 100644 --- a/src/app/features/work-context/store/work-context.effects.ts +++ b/src/app/features/work-context/store/work-context.effects.ts @@ -8,6 +8,7 @@ import { SetSelectedTask } from '../../tasks/store/task.actions'; import { TaskService } from '../../tasks/task.service'; import { BannerId } from '../../../core/banner/banner.model'; import { BannerService } from '../../../core/banner/banner.service'; +import { Observable } from 'rxjs'; @Injectable() export class WorkContextEffects { @@ -22,7 +23,7 @@ export class WorkContextEffects { // tap(this._saveToLs.bind(this)), // ), {dispatch: false}); - dismissContextScopeBannersOnContextChange = createEffect(() => this._actions$ + dismissContextScopeBannersOnContextChange: Observable = createEffect(() => this._actions$ .pipe( ofType( contextActions.setActiveWorkContext, @@ -42,7 +43,7 @@ export class WorkContextEffects { // map(() => new UnsetCurrentTask()), // )); - unselectSelectedTask$ = createEffect(() => this._actions$.pipe( + unselectSelectedTask$: Observable = createEffect(() => this._actions$.pipe( ofType(contextActions.setActiveWorkContext), withLatestFrom(this._taskService.isTaskDataLoaded$), filter(([, isDataLoaded]) => isDataLoaded), diff --git a/src/app/features/work-context/store/work-context.reducer.ts b/src/app/features/work-context/store/work-context.reducer.ts index 692fa39fc2..1ba82de945 100644 --- a/src/app/features/work-context/store/work-context.reducer.ts +++ b/src/app/features/work-context/store/work-context.reducer.ts @@ -30,7 +30,7 @@ const _reducer = createReducer( ); export function workContextReducer( - state = initialContextState, + state: WorkContextState = initialContextState, action: Action, ): WorkContextState { diff --git a/src/app/features/work-view/split/split.component.html b/src/app/features/work-view/split/split.component.html index 244aaf2004..eff49cf72b 100644 --- a/src/app/features/work-view/split/split.component.html +++ b/src/app/features/work-view/split/split.component.html @@ -3,7 +3,7 @@