feat: new linting #2

This commit is contained in:
Johannes Millan 2020-07-02 16:05:10 +02:00
parent b51f661f35
commit 2ac4cd2914
88 changed files with 389 additions and 356 deletions

View file

@ -21,7 +21,7 @@ export class GlobalProgressBarService {
);
private _label$: BehaviorSubject<string | null> = new BehaviorSubject(null);
label$ = this._label$.pipe(
label$: Observable<string> = this._label$.pipe(
distinctUntilChanged(),
switchMap((label) => !!label
? of(label)

View file

@ -26,7 +26,7 @@ const XS_MAX = 599;
providedIn: 'root',
})
export class LayoutService {
isScreenXs$ = this._breakPointObserver.observe([
isScreenXs$: Observable<boolean> = this._breakPointObserver.observe([
`(max-width: ${XS_MAX}px)`,
]).pipe(map(result => result.matches));

View file

@ -52,7 +52,7 @@ const _reducer = createReducer<LayoutState>(
);
export function reducer(
state = _initialLayoutState,
state: LayoutState = _initialLayoutState,
action: Action
): LayoutState {
return _reducer(state, action);

View file

@ -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) {
//
// }
}

View file

@ -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();

View file

@ -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<ProjectState>(LS_PROJECT_META_LIST, 'project', migrateProjectState);
globalConfig = this._cmBase<GlobalConfigState>(LS_GLOBAL_CFG, 'globalConfig', migrateGlobalConfigState);
reminders = this._cmBase<Reminder[]>(LS_REMINDER, 'reminders');
task = this._cmProject<TaskState, Task>(
project: any = this._cmBase<ProjectState>(LS_PROJECT_META_LIST, 'project', migrateProjectState);
globalConfig: any = this._cmBase<GlobalConfigState>(LS_GLOBAL_CFG, 'globalConfig', migrateGlobalConfigState);
reminders: any = this._cmBase<Reminder[]>(LS_REMINDER, 'reminders');
task: any = this._cmProject<TaskState, Task>(
LS_TASK_STATE,
'task',
taskReducer,
);
taskRepeatCfg = this._cmProject<TaskRepeatCfgState, TaskRepeatCfg>(
taskRepeatCfg: any = this._cmProject<TaskRepeatCfgState, TaskRepeatCfg>(
LS_TASK_REPEAT_CFG_STATE,
'taskRepeatCfg',
taskRepeatCfgReducer,
);
taskArchive = this._cmProject<TaskArchive, TaskWithSubTasks>(
taskArchive: any = this._cmProject<TaskArchive, TaskWithSubTasks>(
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<EntityState<TaskAttachment>, TaskAttachment>(
taskAttachment: any = this._cmProject<EntityState<TaskAttachment>, TaskAttachment>(
LS_TASK_ATTACHMENT_STATE,
'taskAttachment',
(state) => state
);
bookmark = this._cmProject<BookmarkState, Bookmark>(
bookmark: any = this._cmProject<BookmarkState, Bookmark>(
LS_BOOKMARK_STATE,
'bookmark',
(state) => state,
);
note = this._cmProject<NoteState, Note>(
note: any = this._cmProject<NoteState, Note>(
LS_NOTE_STATE,
'note',
(state) => state,
);
metric = this._cmProject<MetricState, Metric>(
metric: any = this._cmProject<MetricState, Metric>(
LS_METRIC_STATE,
'metric',
(state) => state,
);
improvement = this._cmProject<ImprovementState, Improvement>(
improvement: any = this._cmProject<ImprovementState, Improvement>(
LS_IMPROVEMENT_STATE,
'improvement',
(state) => state,
);
obstruction = this._cmProject<ObstructionState, Obstruction>(
obstruction: any = this._cmProject<ObstructionState, Obstruction>(
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<any> {
private async _saveToDb(key: string, data: any, isForce: boolean = false): Promise<any> {
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<any> {
private async _removeFromDb(key: string, isForce: boolean = false): Promise<any> {
if (!this._isBlockSaving || isForce === true) {
return this._databaseService.remove(key);
} else {

View file

@ -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;

View file

@ -164,7 +164,7 @@ export class GoogleApiService {
}
}
getFileInfo$(fileId): Observable<any> {
getFileInfo$(fileId: string): Observable<any> {
if (!fileId) {
this._snackIt('ERROR', T.F.GOOGLE.S_API.ERR_NO_FILE_ID);
throwError({[HANDLED_ERROR_PROP_STR]: 'No file id given'});

View file

@ -49,7 +49,7 @@ export class GoogleDriveSyncService {
) {
}
changeSyncFileName(newFileName): void {
changeSyncFileName(newFileName: string): void {
this._store$.dispatch(new ChangeSyncFileName({newFileName}));
}

View file

@ -33,7 +33,7 @@ export class GoogleSyncCfgComponent implements OnInit, OnDestroy {
@ViewChild('formRef', {static: true}) formRef: FormGroup;
@Output() save = new EventEmitter<any>();
@Output() save: EventEmitter<any> = 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);
}

View file

@ -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<GoogleDriveSyncConfig> = this._configService.cfg$.pipe(map(cfg => cfg.googleDriveSync));
isEnabled$: Observable<boolean> = this.config$.pipe(map(cfg => cfg.isEnabled), distinctUntilChanged());
isAutoSyncToRemote$: Observable<boolean> = this.config$.pipe(map(cfg => cfg.isAutoSyncToRemote), distinctUntilChanged());
syncInterval$: Observable<number> = 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<any> {
private _handleErrorForSave$(err: any): Observable<any> {
return of(new SaveToGoogleDriveCancel());
}
private _handleErrorForLoad$(err): Observable<any> {
private _handleErrorForLoad$(err: any): Observable<any> {
this._setInitialSyncDone();
return of(new LoadFromGoogleDriveCancel());
}
@ -475,7 +475,7 @@ export class GoogleDriveSyncEffects {
}
}
private _showAsyncToast(showWhile$: Observable<any> = EMPTY, msg) {
private _showAsyncToast(showWhile$: Observable<any> = EMPTY, msg: string) {
this._snackService.open({
type: 'CUSTOM',
ico: 'file_upload',
@ -485,7 +485,7 @@ export class GoogleDriveSyncEffects {
});
}
private _confirmSaveNewFile$(fileName): Observable<boolean> {
private _confirmSaveNewFile$(fileName: string): Observable<boolean> {
return this._matDialog.open(DialogConfirmComponent, {
restoreFocus: true,
data: {
@ -495,7 +495,7 @@ export class GoogleDriveSyncEffects {
}).afterClosed();
}
private _confirmUsingExistingFileDialog$(fileName): Observable<boolean> {
private _confirmUsingExistingFileDialog$(fileName: string): Observable<boolean> {
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<string> {
private async _import(loadRes: any): Promise<string> {
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());

View file

@ -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};

View file

@ -13,7 +13,7 @@ export interface CacheItem {
providedIn: 'root',
})
export class IssueCacheService {
cache(url: string, requestInit: RequestInit, orgMethod: any, orgArguments: any[], minAlive = 25000): Observable<any> {
cache(url: string, requestInit: RequestInit, orgMethod: any, orgArguments: any[], minAlive: number = 25000): Observable<any> {
const cacheId = getCacheId(requestInit, url);
if (this._isUseCache(cacheId) && requestInit.method === 'GET') {

View file

@ -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() {
}

View file

@ -12,13 +12,13 @@ import { SyncService } from '../../imex/sync/sync.service';
providedIn: 'root',
})
export class IssueEffectHelperService {
pollIssueTaskUpdatesActions$ = this._actions$.pipe(
pollIssueTaskUpdatesActions$: Observable<unknown> = this._actions$.pipe(
ofType(
setActiveWorkContext,
ProjectActionTypes.UpdateProjectIssueProviderCfg,
)
);
pollToBacklogActions$ = this._actions$.pipe(
pollToBacklogActions$: Observable<unknown> = this._actions$.pipe(
ofType(
setActiveWorkContext,
ProjectActionTypes.UpdateProjectIssueProviderCfg,

View file

@ -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() {
}

View file

@ -84,8 +84,8 @@ export class IssueService {
async refreshIssue(
task: Task,
isNotifySuccess = true,
isNotifyNoUpdateRequired = false
isNotifySuccess: boolean = true,
isNotifyNoUpdateRequired: boolean = false
): Promise<void> {
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<string> {
if (this.ISSUE_SERVICE_MAP[issueType].getAddTaskData) {
const {issueId, issueData} = (typeof issueIdOrData === 'number' || typeof issueIdOrData === 'string')

View file

@ -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<boolean> = IS_ELECTRON
? of(true).pipe()
: this._chromeExtensionInterfaceService.onReady$.pipe(
@ -157,15 +157,15 @@ export class JiraApiService {
}, cfg);
}
getIssueById$(issueId, cfg: JiraCfg): Observable<JiraIssue> {
getIssueById$(issueId: string, cfg: JiraCfg): Observable<JiraIssue> {
return this._getIssueById$(issueId, cfg, true);
}
getReducedIssueById$(issueId, cfg: JiraCfg): Observable<JiraIssueReduced> {
getReducedIssueById$(issueId: string, cfg: JiraCfg): Observable<JiraIssueReduced> {
return this._getIssueById$(issueId, cfg, false);
}
getCurrentUser$(cfg: JiraCfg, isForce = false): Observable<JiraOriginalUser> {
getCurrentUser$(cfg: JiraCfg, isForce: boolean = false): Observable<JiraOriginalUser> {
return this._sendRequest$({
pathname: `myself`,
transform: mapResponse,
@ -239,7 +239,7 @@ export class JiraApiService {
}, cfg);
}
private _getIssueById$(issueId, cfg: JiraCfg, isGetChangelog = false): Observable<JiraIssue> {
private _getIssueById$(issueId: string, cfg: JiraCfg, isGetChangelog: boolean = false): Observable<JiraIssue> {
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<any> {
private _sendRequest$(jiraReqCfg: JiraRequestCfg, cfg: JiraCfg, isForce: boolean = false): Observable<any> {
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<any> {
private _sendRequestToExecutor$(requestId: string, url: string, requestInit: RequestInit, transform: any, jiraCfg: JiraCfg): Observable<any> {
// 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);
}

View file

@ -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<Task>, issue: JiraIssue }> {
const cfg = await this._getCfgOnce$(task.projectId).toPromise();
const issue = await this._jiraApiService.getIssueById$(task.issueId, cfg).toPromise() as JiraIssue;

View file

@ -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<TaskWithSubTasks>(1);
issueUrl$ = this._task$.pipe(
private _task$: ReplaySubject<TaskWithSubTasks> = new ReplaySubject(1);
issueUrl$: Observable<string> = this._task$.pipe(
switchMap((task) => this._jiraCommonInterfacesService.issueLink$(task.issueId, task.projectId))
);

View file

@ -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<boolean> = isOnline$;
constructor() {
}

View file

@ -202,7 +202,8 @@ export class JiraIssueEffects {
);
// HOOKS
private _isInitialRequestForProjectDone$ = new BehaviorSubject(false);
private _isInitialRequestForProjectDone$: BehaviorSubject<boolean> = new BehaviorSubject(false);
@Effect({dispatch: false})
checkConnection$: Observable<any> = this._actions$.pipe(
ofType(setActiveWorkContext),

View file

@ -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<JiraCfg> = new EventEmitter();

View file

@ -30,12 +30,12 @@ export class JiraCfgComponent implements OnInit, OnDestroy {
@Input() section: ConfigFormSection<JiraCfg>;
@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<any>;
isLoading$ = new BehaviorSubject(false);
isLoading$: BehaviorSubject<boolean> = 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');
}

View file

@ -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,

View file

@ -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)

View file

@ -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;

View file

@ -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<Note> = {}, remindAt: number = null, isPreventFocus = false) {
public add(note: Partial<Note> = {}, 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<Note>) {
public update(id: string, note: Partial<Note>) {
this._store$.dispatch(updateNote({
note: {
id,
@ -78,7 +78,7 @@ export class NoteService {
}));
}
public async updateFromDifferentWorkContext(workContextId, id, updates: Partial<Note>) {
public async updateFromDifferentWorkContext(workContextId: string, id: string, updates: Partial<Note>) {
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;
}

View file

@ -28,11 +28,11 @@ import { T } from '../../../t.const';
})
export class NotesComponent implements OnInit, OnDestroy {
@Output() scrollToSidenav = new EventEmitter<void>();
@Output() scrollToSidenav: EventEmitter<void> = new EventEmitter();
T: any = T;
isElementWasAdded = false;
isDragOver = false;
isElementWasAdded: boolean = false;
isDragOver: boolean = false;
dragEnterTarget: HTMLElement;
@ViewChild('buttonEl', {static: true}) buttonEl: MatButton;

View file

@ -78,7 +78,7 @@ const _reducer = createReducer<NoteState>(
);
export function noteReducer(
state = initialNoteState,
state: NoteState = initialNoteState,
action: Action
): NoteState {
return _reducer(state, action);

View file

@ -6,8 +6,8 @@ import { WorkContextService } from '../work-context/work-context.service';
@Injectable({providedIn: 'root'})
export class PlanningModeService {
private _iPlanningModeEndedUser$: BehaviorSubject<boolean> = new BehaviorSubject(false);
private _manualTriggerCheck$ = new BehaviorSubject(null);
private _triggerCheck$ = merge(
private _manualTriggerCheck$: BehaviorSubject<unknown> = new BehaviorSubject(null);
private _triggerCheck$: Observable<unknown> = merge(
this._manualTriggerCheck$,
// TODO fix hacky way of waiting for data to be loaded
this._workContextService.onWorkContextChange$.pipe(delay(100))

View file

@ -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}));
}

View file

@ -30,7 +30,7 @@ export class PomodoroEffects {
currentTaskId$: Observable<string> = this._store$.pipe(select(selectCurrentTaskId));
@Effect()
playPauseOnCurrentUpdate$ = this._actions$.pipe(
playPauseOnCurrentUpdate$: Observable<unknown> = this._actions$.pipe(
ofType(
TaskActionTypes.SetCurrentTask,
TaskActionTypes.UnsetCurrentTask,
@ -65,7 +65,7 @@ export class PomodoroEffects {
);
@Effect()
autoStartNextOnSessionStartIfNotAlready$ = this._actions$.pipe(
autoStartNextOnSessionStartIfNotAlready$: Observable<unknown> = this._actions$.pipe(
ofType(
PomodoroActionTypes.FinishPomodoroSession,
PomodoroActionTypes.SkipPomodoroBreak,
@ -83,13 +83,13 @@ export class PomodoroEffects {
);
@Effect()
stopPomodoro$ = this._actions$.pipe(
stopPomodoro$: Observable<unknown> = this._actions$.pipe(
ofType(PomodoroActionTypes.StopPomodoro),
mapTo(new UnsetCurrentTask()),
);
@Effect()
pauseTimeTrackingIfOptionEnabled$ = this._actions$.pipe(
pauseTimeTrackingIfOptionEnabled$: Observable<unknown> = 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<unknown> = this._actions$.pipe(
ofType(
PomodoroActionTypes.PausePomodoro,
PomodoroActionTypes.FinishPomodoroSession,
@ -123,7 +123,7 @@ export class PomodoroEffects {
);
@Effect()
pauseTimeTrackingForPause$ = this._actions$.pipe(
pauseTimeTrackingForPause$: Observable<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = this._pomodoroService.sessionProgress$.pipe(
filter(() => IS_ELECTRON),
withLatestFrom(this._pomodoroService.cfg$),
// we display pomodoro progress for pomodoro

View file

@ -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: {

View file

@ -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<IssueIntegrationCfg>,
isOverwrite = false
isOverwrite: boolean = false
) {
this._store$.dispatch({
type: ProjectActionTypes.UpdateProjectIssueProviderCfg,

View file

@ -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<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = this._actions$.pipe(
ofType(
moveTaskInTodayList,
moveTaskUpInTodayList,
@ -167,7 +167,7 @@ export class ProjectEffects {
);
@Effect()
updateWorkEnd$: any = this._actions$
updateWorkEnd$: Observable<unknown> = 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<unknown> = 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<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.DeleteProject,
@ -225,7 +225,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
archiveProject: any = this._actions$
archiveProject: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.ArchiveProject,
@ -241,7 +241,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
unarchiveProject: any = this._actions$
unarchiveProject: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.UnarchiveProject,
@ -259,7 +259,7 @@ export class ProjectEffects {
// PURE SNACKS
// -----------
@Effect({dispatch: false})
snackUpdateIssueProvider$: any = this._actions$
snackUpdateIssueProvider$: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.UpdateProjectIssueProviderCfg,
@ -276,7 +276,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
snackUpdateBaseSettings$: any = this._actions$
snackUpdateBaseSettings$: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.UpdateProject,
@ -290,7 +290,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
onProjectCreatedSnack: any = this._actions$
onProjectCreatedSnack: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.AddProject,
@ -306,7 +306,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
showDeletionSnack: any = this._actions$
showDeletionSnack: Observable<unknown> = this._actions$
.pipe(
ofType(
ProjectActionTypes.DeleteProject,
@ -320,7 +320,7 @@ export class ProjectEffects {
);
@Effect({dispatch: false})
cleanupTaskListOfNonProjectTasks: any = this._workContextService.activeWorkContextTypeAndId$
cleanupTaskListOfNonProjectTasks: Observable<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = this._actions$.pipe(
// ofType(TaskActionTypes.UpdateTaskTags),
// filter((action: UpdateTaskTags) =>
// action.payload.task.projectId &&

View file

@ -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,

View file

@ -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();
}

View file

@ -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<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = createEffect(() => this._actions$.pipe(
ofType(updateAllSimpleCounters),
tap(() => this._snackService.open({
type: 'SUCCESS',

View file

@ -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<unknown> = 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<unknown> = 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<unknown> = 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<unknown> = createEffect(() => this._actions$.pipe(
ofType(
moveTaskInTodayList,
moveTaskUpInTodayList,
@ -141,7 +141,7 @@ export class TagEffects {
);
@Effect()
updateWorkEnd$: any = this._actions$.pipe(
updateWorkEnd$: Observable<unknown> = 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<unknown> = this._actions$.pipe(
ofType(
deleteTag,
deleteTags,
@ -190,7 +190,7 @@ export class TagEffects {
);
@Effect({dispatch: false})
redirectIfCurrentTagIsDeleted: any = this._actions$.pipe(
redirectIfCurrentTagIsDeleted: Observable<unknown> = this._actions$.pipe(
ofType(
deleteTag,
deleteTags,
@ -204,7 +204,7 @@ export class TagEffects {
);
@Effect({dispatch: false})
cleanupNullTasksForTaskList: any = this._workContextService.activeWorkContextTypeAndId$.pipe(
cleanupNullTasksForTaskList: Observable<unknown> = this._workContextService.activeWorkContextTypeAndId$.pipe(
filter(({activeType}) => activeType === WorkContextType.TAG),
switchMap(({activeType, activeId}) => this._workContextService.todaysTasks$.pipe(
take(1),

View file

@ -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<TagState>(
);
export function tagReducer(
state = initialTagState,
state: TagState = initialTagState,
action: Action,
): TagState {
switch (action.type) {

View file

@ -16,7 +16,7 @@ export interface TagComponentTag {
export class TagComponent {
tag: TagComponentTag;
// @HostBinding('style.background')
color;
color: string;
constructor() {
}

View file

@ -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);
}

View file

@ -22,7 +22,7 @@ export const initialTaskRepeatCfgState: TaskRepeatCfgState = adapter.getInitialS
});
export function taskRepeatCfgReducer(
state = initialTaskRepeatCfgState,
state: TaskRepeatCfgState = initialTaskRepeatCfgState,
action: TaskRepeatCfgActions
): TaskRepeatCfgState {

View file

@ -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 => {

View file

@ -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 => {

View file

@ -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<Task | string>();
isCreate: boolean = false;
@Output() taskChange: EventEmitter<Task | string> = new EventEmitter();
private _destroy$: Subject<boolean> = new Subject<boolean>();
constructor(

View file

@ -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;

View file

@ -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) {

View file

@ -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(

View file

@ -20,11 +20,11 @@ export class TaskAdditionalInfoItemComponent {
@Input() expanded: boolean;
@Input() inputIcon: string;
@Output() collapseParent = new EventEmitter<void>();
@Output() keyPress = new EventEmitter<KeyboardEvent>();
@Output() editActionTriggered = new EventEmitter<void>();
@Output() collapseParent: EventEmitter<void> = new EventEmitter();
@Output() keyPress: EventEmitter<KeyboardEvent> = new EventEmitter();
@Output() editActionTriggered: EventEmitter<void> = new EventEmitter();
@HostBinding('tabindex') tabindex = 3;
@HostBinding('tabindex') readonly tabindex: number = 3;
constructor(
public elementRef: ElementRef

View file

@ -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<TaskWithSubTasks> = this.taskService.selectedTask$.pipe(
switchMap((task) => task
? of(task)
: of(null).pipe(delay(200))

View file

@ -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<TaskAdditionalInfoItemComponent>;
@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<string | null> = new BehaviorSubject(null);
reminderData$: Observable<ReminderCopy> = 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<string | null> = new BehaviorSubject(null);
repeatCfgDays$: Observable<string> = 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<TaskAttachmentCopy[]> = this.issueData$.pipe(
withLatestFrom(this.issueIdAndTypeShared$),
map(([data, {type}]) => (data && type)
? this._issueService.getMappedAttachments(type, data)
: [])
);
private _taskData: TaskWithSubTasks;
issueData$: Observable<IssueData> = 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<TaskAttachmentCopy[]> = 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);

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;

View file

@ -13,7 +13,7 @@ import { T } from '../../../t.const';
export class TaskSummaryTableComponent {
@Input() flatTasks: Task[];
@Input() day: string = getWorklogStr();
@Output() updated = new EventEmitter<void>();
@Output() updated: EventEmitter<void> = new EventEmitter();
T: any = T;

View file

@ -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<boolean> = 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<Task> = {},
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}));
}

View file

@ -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<TaskWithSubTasks>(1);
TODAY_TAG_ID: string = TODAY_TAG.id;
private _task$: ReplaySubject<TaskWithSubTasks> = new ReplaySubject(1);
issueUrl$: Observable<string> = 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) {

View file

@ -21,7 +21,7 @@ const IDLE_POLL_INTERVAL = 1000;
providedIn: 'root',
})
export class IdleService {
isIdle = false;
isIdle: boolean = false;
private _isIdle$: BehaviorSubject<boolean> = new BehaviorSubject(false);
isIdle$: Observable<boolean> = this._isIdle$.asObservable().pipe(
distinctUntilChanged(),
@ -30,11 +30,11 @@ export class IdleService {
private _idleTime$: BehaviorSubject<number> = new BehaviorSubject(0);
idleTime$: Observable<number> = this._idleTime$.asObservable();
private _triggerResetBreakTimer$ = new Subject<boolean>();
private _triggerResetBreakTimer$: Subject<boolean> = new Subject();
triggerResetBreakTimer$: Observable<boolean> = 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(() => {

View file

@ -79,7 +79,7 @@ export class TakeABreakService {
map(tick => tick.duration),
);
private _triggerSnooze$ = new Subject<number>();
private _triggerSnooze$: Subject<number> = new Subject();
private _snoozeActive$: Observable<boolean> = this._triggerSnooze$.pipe(
startWith(false),
switchMap((val: boolean | number) => {
@ -102,7 +102,7 @@ export class TakeABreakService {
}),
);
private _triggerManualReset$ = new Subject<number>();
private _triggerManualReset$: Subject<number> = new Subject<number>();
private _triggerReset$: Observable<number> = merge(
this._triggerProgrammaticReset$,
@ -125,8 +125,8 @@ export class TakeABreakService {
shareReplay(1),
);
private _triggerLockScreenCounter$ = new Subject<boolean>();
private _triggerLockScreenThrottledAndDelayed$ = this._triggerLockScreenCounter$.pipe(
private _triggerLockScreenCounter$: Subject<boolean> = new Subject();
private _triggerLockScreenThrottledAndDelayed$: Observable<unknown | never> = 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);
}

View file

@ -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,

View file

@ -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<unknown> = createEffect(() => this._actions$
.pipe(
ofType(
contextActions.setActiveWorkContext,
@ -42,7 +43,7 @@ export class WorkContextEffects {
// map(() => new UnsetCurrentTask()),
// ));
unselectSelectedTask$ = createEffect(() => this._actions$.pipe(
unselectSelectedTask$: Observable<unknown> = createEffect(() => this._actions$.pipe(
ofType(contextActions.setActiveWorkContext),
withLatestFrom(this._taskService.isTaskDataLoaded$),
filter(([, isDataLoaded]) => isDataLoaded),

View file

@ -30,7 +30,7 @@ const _reducer = createReducer<WorkContextState>(
);
export function workContextReducer(
state = initialContextState,
state: WorkContextState = initialContextState,
action: Action,
): WorkContextState {

View file

@ -3,7 +3,7 @@
<button #buttonEl
(dblclick)="toggle()"
(mousedown)="onMouseDown()"
(touchstart)="onTouchStart($event)"
(touchstart)="onTouchStart()"
[class.isAnimate]="isAnimateBtn"
color="primary"
mat-fab>

View file

@ -2,6 +2,7 @@ import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
ElementRef,
EventEmitter,
Input,
Output,
@ -20,18 +21,18 @@ const ANIMATABLE_CLASS = 'isAnimatable';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SplitComponent implements AfterViewInit {
@Input() splitTopEl;
@Input() splitBottomEl;
@Input() containerEl;
@Input() counter;
@Input() isAnimateBtn;
@Input() splitTopEl: ElementRef;
@Input() splitBottomEl: ElementRef;
@Input() containerEl: HTMLElement;
@Input() counter: ElementRef;
@Input() isAnimateBtn: boolean;
@Output() posChanged: EventEmitter<number> = new EventEmitter();
pos: number;
eventSubs: Subscription;
@ViewChild('buttonEl', {static: true}) buttonEl;
private _isDrag = false;
private _isViewInitialized = false;
@ViewChild('buttonEl', {static: true}) buttonEl: ElementRef;
private _isDrag: boolean = false;
private _isViewInitialized: boolean = false;
constructor(private _renderer: Renderer2) {
}
@ -64,7 +65,7 @@ export class SplitComponent implements AfterViewInit {
this._updatePos(newPos);
}
onTouchStart(ev) {
onTouchStart() {
this._isDrag = false;
const touchend$ = fromEvent(document, 'touchend');
this.eventSubs = touchend$.subscribe((e: TouchEvent) => this.onMoveEnd(e));
@ -88,7 +89,7 @@ export class SplitComponent implements AfterViewInit {
this.eventSubs.add(mousemove$);
}
onMoveEnd(ev): void {
onMoveEnd(ev: TouchEvent): void {
if (this.eventSubs) {
this.eventSubs.unsubscribe();
this.eventSubs = undefined;
@ -99,10 +100,10 @@ export class SplitComponent implements AfterViewInit {
}
}
onMove(ev) {
const clientY = (typeof ev.clientY === 'number')
? ev.clientY
: ev.touches[0].clientY;
onMove(ev: TouchEvent | MouseEvent) {
const clientY = (typeof (ev as MouseEvent).clientY === 'number')
? (ev as MouseEvent).clientY
: (ev as TouchEvent).touches[0].clientY;
this._renderer.removeClass(this.splitTopEl, ANIMATABLE_CLASS);
this._renderer.removeClass(this.splitBottomEl, ANIMATABLE_CLASS);
this._isDrag = true;
@ -120,7 +121,7 @@ export class SplitComponent implements AfterViewInit {
this._updatePos(percentage);
}
private _updatePos(pos: number, isWasOutsideChange = false) {
private _updatePos(pos: number, isWasOutsideChange: boolean = false) {
this.pos = pos;
if (this.splitTopEl && this.splitBottomEl) {
this._renderer.setStyle(

View file

@ -14,7 +14,7 @@ import { LayoutService } from '../../core-ui/layout/layout.service';
import { DragulaService } from 'ng2-dragula';
import { TakeABreakService } from '../../features/time-tracking/take-a-break/take-a-break.service';
import { ActivatedRoute } from '@angular/router';
import { from, fromEvent, ReplaySubject, Subscription, timer, zip } from 'rxjs';
import { from, fromEvent, Observable, ReplaySubject, Subscription, timer, zip } from 'rxjs';
import { TaskWithSubTasks } from '../../features/tasks/task.model';
import { delay, filter, map, switchMap } from 'rxjs/operators';
import { fadeAnimation } from '../../ui/animations/fade.ani';
@ -39,15 +39,15 @@ export class WorkViewComponent implements OnInit, OnDestroy, AfterContentInit {
@Input() undoneTasks: TaskWithSubTasks[];
@Input() doneTasks: TaskWithSubTasks[];
@Input() backlogTasks: TaskWithSubTasks[];
@Input() isShowBacklog = false;
@Input() isShowBacklog: boolean = false;
isShowTimeWorkedWithoutBreak = true;
splitInputPos = 100;
isPreloadBacklog = false;
isShowTimeWorkedWithoutBreak: boolean = true;
splitInputPos: number = 100;
isPreloadBacklog: boolean = false;
T: any = T;
// NOTE: not perfect but good enough for now
isTriggerBacklogIconAni$ = this.workContextService.onMoveToBacklog$.pipe(
isTriggerBacklogIconAni$: Observable<boolean> = this.workContextService.onMoveToBacklog$.pipe(
switchMap(() =>
zip(
from([true, false]),
@ -56,10 +56,10 @@ export class WorkViewComponent implements OnInit, OnDestroy, AfterContentInit {
),
map(v => v[0]),
);
splitTopEl$ = new ReplaySubject<HTMLElement>(1);
splitTopEl$: ReplaySubject<HTMLElement> = new ReplaySubject(1);
// TODO make this work for tag page without backlog
upperContainerScroll$ = this.workContextService.isContextChanging$.pipe(
upperContainerScroll$: Observable<Event> = this.workContextService.isContextChanging$.pipe(
filter(isChanging => !isChanging),
delay(50),
switchMap(() => this.splitTopEl$),

View file

@ -59,10 +59,10 @@ export class WorklogExportComponent implements OnInit, OnDestroy {
@Input() isWorklogExport: boolean;
@Input() isShowClose: boolean;
@Output() cancel = new EventEmitter();
@Output() cancel: EventEmitter<void> = new EventEmitter();
T: any = T;
isShowAsText = false;
isShowAsText: boolean = false;
headlineCols: string[] = [];
formattedRows: (string | number)[][];
options: WorklogExportSettingsCopy = {
@ -70,14 +70,14 @@ export class WorklogExportComponent implements OnInit, OnDestroy {
cols: [...WORKLOG_EXPORT_DEFAULTS.cols],
};
txt: string;
fileName = 'tasks.csv';
roundTimeOptions = [
fileName: string = 'tasks.csv';
roundTimeOptions: { id: string; title: string }[] = [
{id: 'QUARTER', title: T.F.WORKLOG.EXPORT.O.FULL_QUARTERS},
{id: 'HALF', title: T.F.WORKLOG.EXPORT.O.FULL_HALF_HOURS},
{id: 'HOUR', title: T.F.WORKLOG.EXPORT.O.FULL_HOURS},
];
colOpts = [
colOpts: { id: string; title: string }[] = [
{id: 'DATE', title: T.F.WORKLOG.EXPORT.O.DATE},
{id: 'START', title: T.F.WORKLOG.EXPORT.O.STARTED_WORKING},
{id: 'END', title: T.F.WORKLOG.EXPORT.O.ENDED_WORKING},
@ -91,7 +91,7 @@ export class WorklogExportComponent implements OnInit, OnDestroy {
{id: 'ESTIMATE_CLOCK', title: T.F.WORKLOG.EXPORT.O.ESTIMATE_AS_CLOCK},
];
groupByOptions = [
groupByOptions: { id: string; title: string }[] = [
{id: WorklogGrouping.DATE, title: T.F.WORKLOG.EXPORT.O.DATE},
{id: WorklogGrouping.TASK, title: T.F.WORKLOG.EXPORT.O.TASK_SUBTASK},
{id: WorklogGrouping.PARENT, title: T.F.WORKLOG.EXPORT.O.PARENT_TASK},

View file

@ -22,7 +22,7 @@ import { SimpleCounterService } from '../../simple-counter/simple-counter.servic
export class WorklogWeekComponent {
visibility: boolean[] = [];
T: any = T;
keys = Object.keys;
keys: (o: object) => string[] = Object.keys;
constructor(
public readonly worklogService: WorklogService,
@ -32,7 +32,7 @@ export class WorklogWeekComponent {
) {
}
sortDays(a, b) {
sortDays(a: any, b: any) {
return a.key - b.key;
}
@ -64,11 +64,11 @@ export class WorklogWeekComponent {
this.worklogService.refreshWorklog();
}
trackByDay(i, day) {
trackByDay(i: number, day: any) {
return day.key;
}
trackByLogEntry(i, logEntry: WorklogDataForDay) {
trackByLogEntry(i: number, logEntry: WorklogDataForDay) {
return logEntry.task.id;
}
}

View file

@ -42,12 +42,12 @@ export class SyncService {
filter(({appDataKey, data, isDataImport}) => !!data && !isDataImport),
);
// ------------------
private _focusAppTrigger$ = fromEvent(window, 'focus').pipe(
private _focusAppTrigger$: Observable<string> = fromEvent(window, 'focus').pipe(
throttleTime(SYNC_USER_ACTIVITY_CHECK_THROTTLE_TIME),
mapTo('I_FOCUS_THROTTLED'),
);
// we might need this for mobile, as we can't rely on focus as much
private _someMobileActivityTrigger$ = of(isTouchOnly()).pipe(
private _someMobileActivityTrigger$: Observable<string> = of(isTouchOnly()).pipe(
switchMap((isTouchIn) => isTouchIn
? fromEvent(window, 'touchstart').pipe(
throttleTime(SYNC_USER_ACTIVITY_CHECK_THROTTLE_TIME),
@ -56,7 +56,7 @@ export class SyncService {
: EMPTY
),
);
private _isOnlineTrigger$ = isOnline$.pipe(
private _isOnlineTrigger$: Observable<string> = isOnline$.pipe(
// skip initial online which always fires on page load
skip(1),
filter(isOnline => isOnline),
@ -64,7 +64,7 @@ export class SyncService {
);
// OTHER INITIAL SYNC STUFF
private _immediateSyncTrigger$ = merge(
private _immediateSyncTrigger$: Observable<string> = merge(
this._focusAppTrigger$,
this._someMobileActivityTrigger$,
this._isOnlineTrigger$,
@ -88,7 +88,7 @@ export class SyncService {
distinctUntilChanged(),
);
// keep it super simple for now
private _isInitialSyncDoneManual$ = new ReplaySubject<boolean>(1);
private _isInitialSyncDoneManual$: ReplaySubject<boolean> = new ReplaySubject<boolean>(1);
private _isInitialSyncDone$: Observable<boolean> = this._isInitialSyncEnabled$.pipe(
switchMap((isActive) => {
return isActive

View file

@ -87,7 +87,7 @@ export class ProjectOverviewPageComponent implements OnInit, OnDestroy {
reader.readAsText(file);
}
edit(project) {
edit(project: Project) {
this._matDialog.open(DialogCreateProjectComponent, {
restoreFocus: true,
data: Object.assign({}, project),
@ -124,7 +124,7 @@ export class ProjectOverviewPageComponent implements OnInit, OnDestroy {
});
}
remove(projectId) {
remove(projectId: string) {
this._matDialog.open(DialogConfirmComponent, {
restoreFocus: true,
data: {

View file

@ -12,6 +12,7 @@ import { take } from 'rxjs/operators';
import { AddTaskReminderInterface } from '../../features/tasks/dialog-add-task-reminder/add-task-reminder-interface';
import { WorkContextService } from '../../features/work-context/work-context.service';
import { TODAY_TAG } from '../../features/tag/tag.const';
import { Tag } from '../../features/tag/tag.model';
@Component({
selector: 'schedule-page',
@ -22,7 +23,7 @@ import { TODAY_TAG } from '../../features/tag/tag.const';
})
export class SchedulePageComponent {
T: any = T;
TODAY_TAG = TODAY_TAG;
TODAY_TAG: Tag = TODAY_TAG;
constructor(
public scheduledTaskService: ScheduledTaskService,

View file

@ -1,5 +1,5 @@
export const T = {
'APP': {
APP: {
'B_INSTALL': {
'IGNORE': 'APP.B_INSTALL.IGNORE',
'INSTALL': 'APP.B_INSTALL.INSTALL',

View file

@ -24,7 +24,7 @@ import { T } from '../../../t.const';
})
export class InputDurationSliderComponent implements OnInit, OnDestroy {
T: any = T;
minutesBefore = 0;
minutesBefore: number = 0;
dots: any[];
uid: string = 'duration-input-slider' + shortid();
el: HTMLElement;
@ -47,7 +47,7 @@ export class InputDurationSliderComponent implements OnInit, OnDestroy {
_model: number;
@Input() set model(val) {
@Input() set model(val: number) {
if (this._model !== val) {
this._model = val;
this.setRotationFromValue(val);
@ -81,7 +81,7 @@ export class InputDurationSliderComponent implements OnInit, OnDestroy {
// prevent touchmove
ev.preventDefault();
function convertThetaToCssDegrees(thetaIN) {
function convertThetaToCssDegrees(thetaIN: number) {
return 90 - thetaIN;
}
@ -138,18 +138,18 @@ export class InputDurationSliderComponent implements OnInit, OnDestroy {
document.removeEventListener('touchend', this.endHandler);
}
setCircleRotation(cssDegrees) {
setCircleRotation(cssDegrees: number) {
this.circleEl.nativeElement.style.transform = 'rotate(' + cssDegrees + 'deg)';
}
setDots(hours = 0) {
setDots(hours: number = 0) {
if (hours > 12) {
hours = 12;
}
this.dots = new Array(hours);
}
setValueFromRotation(degrees) {
setValueFromRotation(degrees: number) {
const THRESHOLD = 40;
let minutesFromDegrees;
@ -198,13 +198,13 @@ export class InputDurationSliderComponent implements OnInit, OnDestroy {
this._cd.detectChanges();
}
onInputChange($event) {
onInputChange($event: number) {
this._model = $event;
this.modelChange.emit(this._model);
this.setRotationFromValue();
}
setRotationFromValue(val = this._model) {
setRotationFromValue(val: number = this._model) {
const momentVal = moment.duration({
milliseconds: val
});

View file

@ -50,7 +50,7 @@ export const INPUT_DURATION_VALIDATORS: any = {
})
export class InputDurationDirective<D> implements ControlValueAccessor, Validator, AfterViewChecked {
@Input() isAllowSeconds = false;
@Input() isAllowSeconds: boolean = false;
// by the Control Value Accessor
private _onTouchedCallback: () => void = noop;
@ -61,23 +61,24 @@ export class InputDurationDirective<D> implements ControlValueAccessor, Validato
// -----------
private _parseValidator: ValidatorFn = this._parseValidatorFn.bind(this);
private _validator: ValidatorFn | null;
private _msValue;
private _msValue: number;
constructor(@Attribute('inputDuration') public inputDuration,
constructor(
@Attribute('inputDuration') public inputDuration: Attribute,
private _elementRef: ElementRef,
private _stringToMs: StringToMsPipe,
private _msToString: MsToStringPipe,
private _renderer: Renderer2) {
}
private _value;
private _value: string;
// Validations
get value() {
get value(): string {
return this._value;
}
set value(value) {
set value(value: string) {
if (value !== this._value) {
this._value = value;
this._onChangeCallback(this._msValue);
@ -85,10 +86,10 @@ export class InputDurationDirective<D> implements ControlValueAccessor, Validato
}
// TODO all around dirty
@Input() set ngModel(msVal) {
@Input() set ngModel(msVal: number) {
if (msVal && msVal !== this._msValue) {
this._msValue = msVal;
this.writeValue(msVal);
this.writeValue(msVal.toString());
}
}
@ -125,7 +126,7 @@ export class InputDurationDirective<D> implements ControlValueAccessor, Validato
}
// ControlValueAccessor: Formatter
writeValue(value): void {
writeValue(value: string): void {
if (!value) {
value = '';
}

View file

@ -27,6 +27,6 @@ export const msToMinuteClockString = (value: any): string => {
name: 'msToMinuteClockString'
})
export class MsToMinuteClockStringPipe implements PipeTransform {
transform = msToMinuteClockString;
transform: (value: any, ...args: any[]) => any = msToMinuteClockString;
}

View file

@ -48,5 +48,5 @@ export const stringToMs = (strValue: any, args?: any): any => {
name: 'stringToMs'
})
export class StringToMsPipe implements PipeTransform {
transform = stringToMs;
transform: (value: any, ...args: any[]) => any = stringToMs;
}

View file

@ -17,16 +17,16 @@ import {
changeDetection: ChangeDetectionStrategy.OnPush
})
export class InlineInputComponent implements AfterViewInit {
@Input() type = 'text';
@Input() type: 'text' | 'duration' = 'text';
@Input() value: string | number;
@Input() displayValue: string;
@Input() newValue: string | number;
@Output() changed = new EventEmitter<string | number>();
@Output() changed: EventEmitter<string | number> = new EventEmitter();
@ViewChild('inputEl') inputEl: ElementRef;
@ViewChild('inputElDuration') inputElDuration: ElementRef;
@HostBinding('class.isFocused') isFocused = false;
@HostBinding('class.isFocused') isFocused: boolean = false;
activeInputEl: HTMLInputElement;
@ -60,11 +60,11 @@ export class InlineInputComponent implements AfterViewInit {
}
}
onChange(v) {
onChange(v: string | number) {
this.newValue = v;
}
keypressHandler(ev) {
keypressHandler(ev: KeyboardEvent) {
if (ev.key === 'Escape') {
this.newValue = null;
this.activeInputEl.blur();

View file

@ -31,8 +31,8 @@ const HIDE_OVERFLOW_TIMEOUT_DURATION = 300;
animations: [fadeAnimation]
})
export class InlineMarkdownComponent implements OnInit, OnDestroy {
@Input() isLock = false;
@Input() isShowControls = false;
@Input() isLock: boolean = false;
@Input() isShowControls: boolean = false;
@Output() changed: EventEmitter<string> = new EventEmitter();
@Output() focused: EventEmitter<Event> = new EventEmitter();
@ -42,8 +42,8 @@ export class InlineMarkdownComponent implements OnInit, OnDestroy {
@ViewChild('textareaEl') textareaEl: ElementRef;
@ViewChild('previewEl') previewEl: MarkdownComponent;
isHideOverflow = false;
isShowEdit = false;
isHideOverflow: boolean = false;
isShowEdit: boolean = false;
modelCopy: string;
isTurnOffMarkdownParsing$: Observable<boolean> = this._globalConfigService.misc$.pipe(
@ -114,9 +114,9 @@ export class InlineMarkdownComponent implements OnInit, OnDestroy {
}
}
toggleShowEdit($event?) {
toggleShowEdit($event?: MouseEvent) {
// check if anchor link was clicked
if (!$event || $event.target.tagName !== 'A') {
if (!$event || ($event.target as HTMLElement).tagName !== 'A') {
this.isShowEdit = true;
this.modelCopy = this.model || '';

View file

@ -9,7 +9,7 @@ import { T } from 'src/app/t.const';
})
export class OwlWrapperComponent {
@Input()
now = new Date();
now: Date = new Date();
@Input()
model: number;
@ -19,8 +19,8 @@ export class OwlWrapperComponent {
@Output()
triggerSubmit: EventEmitter<number> = new EventEmitter();
T: any = T;
date = new Date();
laterTodaySlots = [
date: Date = new Date();
laterTodaySlots: string[] = [
'9:00',
'15:00',
'17:00',
@ -46,7 +46,7 @@ export class OwlWrapperComponent {
this.triggerSubmit.emit(this.dateTime);
}
updateDateFromCal(date) {
updateDateFromCal(date: any) {
this.dateTime = new Date(date).getTime();
this.dateTimeChange.emit(this.dateTime);
}

View file

@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core';
name: 'sort'
})
export class SortPipe implements PipeTransform {
transform(array: any[], field: string, reverse = false): any[] {
transform(array: any[], field: string, reverse: boolean = false): any[] {
const f = reverse ? -1 : 1;
if (!Array.isArray(array)) {

View file

@ -7,12 +7,12 @@ import { ChangeDetectionStrategy, Component, ElementRef, HostBinding, Input } fr
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ProgressBarComponent {
@HostBinding('class') @Input() cssClass = 'bg-primary';
@HostBinding('class') @Input() cssClass: string = 'bg-primary';
constructor(private _elRef: ElementRef) {
}
@Input() set progress(_value) {
@Input() set progress(_value: number) {
let val;
if (_value > 100) {
val = 100;

View file

@ -10,5 +10,5 @@ import { T } from '../../t.const';
})
export class ThemeSelectComponent {
T: any = T;
themes = ALL_THEMES;
themes: string[] = ALL_THEMES;
}

View file

@ -1,8 +1,8 @@
export function isImageUrlSimple(url) {
export function isImageUrlSimple(url: string): boolean {
return (url.match(/\.(jpeg|jpg|gif|png)$/i) != null);
}
export function isImageUrl(url): Promise<boolean> {
export function isImageUrl(url: string): Promise<boolean> {
return new Promise(resolve => {
const timeout = 5000;
const img = new Image();

View file

@ -1,3 +1,3 @@
export function isObject(obj) {
export function isObject(obj: any): boolean {
return obj === Object(obj);
}

View file

@ -1,3 +1,3 @@
export function promiseTimeout(ms) {
export function promiseTimeout(ms: number): Promise<unknown> {
return new Promise(resolve => setTimeout(resolve, ms));
}

View file

@ -32,6 +32,10 @@
"no-inferrable-types": false,
"strict-type-predicates": true,
"template-use-track-by-function": true,
"align": false
"align": false,
"max-line-length": [
true,
180
]
}
}