From 244b4ae3973bc1511464a08158a123767f83179c Mon Sep 17 00:00:00 2001 From: BO41 Date: Thu, 18 Oct 2018 09:08:59 +0200 Subject: NoImplicitAny flag true (#1157) this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137 --- .../edit-custom-config/edit-custom-config.component.ts | 4 ++-- client/src/app/+admin/users/user-edit/user-edit.ts | 2 +- .../src/app/+admin/users/user-list/user-list.component.ts | 4 ++-- .../my-account-video-channel-update.component.ts | 2 +- .../my-account-videos/my-account-videos.component.ts | 9 +++++---- .../video-change-ownership.component.ts | 3 ++- .../app/+my-account/shared/actor-avatar-info.component.ts | 2 +- client/src/app/app.module.ts | 2 +- client/src/app/core/auth/auth.service.ts | 2 +- client/src/app/core/server/server.service.ts | 2 +- client/src/app/core/theme/theme.service.ts | 4 ++-- client/src/app/menu/menu.component.ts | 2 +- client/src/app/search/advanced-search.model.ts | 4 ++-- client/src/app/shared/buttons/action-dropdown.component.ts | 6 +++--- client/src/app/shared/buttons/button.component.ts | 6 +++--- client/src/app/shared/buttons/edit-button.component.ts | 2 +- client/src/app/shared/misc/help.component.ts | 2 +- client/src/app/shared/misc/peertube-local-storage.ts | 6 +++--- client/src/app/shared/misc/utils.ts | 2 +- client/src/app/shared/overview/videos-overview.model.ts | 1 + client/src/app/shared/rest/rest-extractor.service.ts | 4 ++-- client/src/app/shared/rest/rest.service.ts | 2 +- client/src/app/shared/users/user.model.ts | 1 + client/src/app/shared/video/abstract-video-list.ts | 6 +++--- client/src/app/shared/video/video-edit.model.ts | 3 ++- client/src/app/shared/video/video-feed.component.ts | 2 +- client/src/app/shared/video/video.service.ts | 2 +- .../shared/video-caption-add-modal.component.ts | 4 ++-- .../app/videos/+video-edit/shared/video-edit.component.ts | 6 +++--- .../video-add-components/video-import-torrent.component.ts | 2 +- .../videos/+video-edit/video-add-components/video-send.ts | 2 +- .../video-add-components/video-upload.component.ts | 2 +- .../app/videos/+video-watch/comment/linkifier.service.ts | 6 +++--- .../+video-watch/comment/video-comment-add.component.ts | 2 +- .../videos/+video-watch/comment/video-comment.component.ts | 2 +- .../app/videos/+video-watch/comment/video-comment.model.ts | 2 +- .../videos/+video-watch/comment/video-comment.service.ts | 4 ++-- .../+video-watch/comment/video-comments.component.ts | 2 +- .../src/app/videos/+video-watch/video-watch.component.ts | 14 +++++++------- 39 files changed, 70 insertions(+), 65 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 25b303f44..9a9298825 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -62,7 +62,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } ngOnInit () { - const formGroupData = { + const formGroupData: any = { instanceName: this.customConfigValidatorsService.INSTANCE_NAME, instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, instanceDescription: null, @@ -202,7 +202,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } private updateForm () { - const data = { + const data: any = { instanceName: this.customConfig.instance.name, instanceShortDescription: this.customConfig.instance.shortDescription, instanceDescription: this.customConfig.instance.description, diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 99ce5804b..a4d696e69 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -7,7 +7,7 @@ export abstract class UserEdit extends FormReactive { videoQuotaOptions: { value: string, label: string }[] = [] videoQuotaDailyOptions: { value: string, label: string }[] = [] - roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) protected abstract serverService: ServerService protected abstract configService: ConfigService diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index ab2250722..0d7f88d2b 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -45,12 +45,12 @@ export class UserListComponent extends RestTable implements OnInit { { label: this.i18n('Ban'), handler: users => this.openBanUserModal(users), - isDisplayed: users => users.every(u => u.blocked === false) + isDisplayed: users => users.every((u: any) => u.blocked === false) }, { label: this.i18n('Unban'), handler: users => this.unbanUsers(users), - isDisplayed: users => users.every(u => u.blocked === true) + isDisplayed: users => users.every((u: any) => u.blocked === true) } ] } diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index 56697030b..f2b8a4e26 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts @@ -17,7 +17,7 @@ import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators styleUrls: [ './my-account-video-channel-edit.component.scss' ] }) export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy { - @ViewChild('avatarfileInput') avatarfileInput + @ViewChild('avatarfileInput') avatarfileInput: any error: string diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index 7560f0128..52307f09e 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts @@ -66,7 +66,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni } isInSelectionMode () { - return Object.keys(this.checkedVideos).some(k => this.checkedVideos[ k ] === true) + return Object.keys(this.checkedVideos).some((k: any) => this.checkedVideos[ k ] === true) } getVideosObservable (page: number) { @@ -81,7 +81,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni async deleteSelectedVideos () { const toDeleteVideosIds = Object.keys(this.checkedVideos) - .filter(k => this.checkedVideos[ k ] === true) + .filter((k: any) => this.checkedVideos[ k ] === true) .map(k => parseInt(k, 10)) const res = await this.confirmService.confirm( @@ -168,9 +168,10 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni } private spliceVideosById (id: number) { - for (const key of Object.keys(this.loadedPages)) { + let key: any + for (key of Object.keys(this.loadedPages)) { const videos = this.loadedPages[ key ] - const index = videos.findIndex(v => v.id === id) + const index = videos.findIndex((v: any) => v.id === id) if (index !== -1) { videos.splice(index, 1) diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index 7437b939a..eb3f9404f 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts @@ -49,7 +49,8 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni .catch((_) => _) // Called when closing (cancel) the modal without validating, do nothing } - search (event) { + // TODO: typing + search (event: any) { const query = event.query this.userService.autocomplete(query) .subscribe( diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.ts b/client/src/app/+my-account/shared/actor-avatar-info.component.ts index 7b80b1ed4..b4505a7f2 100644 --- a/client/src/app/+my-account/shared/actor-avatar-info.component.ts +++ b/client/src/app/+my-account/shared/actor-avatar-info.component.ts @@ -10,7 +10,7 @@ import { Account } from '@app/shared/account/account.model' styleUrls: [ './actor-avatar-info.component.scss' ] }) export class ActorAvatarInfoComponent { - @ViewChild('avatarfileInput') avatarfileInput + @ViewChild('avatarfileInput') avatarfileInput: any @Input() actor: VideoChannel | Account diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 34e890b40..371199442 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -69,7 +69,7 @@ export function metaFactory (serverService: ServerService): MetaLoader { providers: [ { provide: TRANSLATIONS, - useFactory: (locale) => { + useFactory: (locale: string) => { // On dev mode, test localization if (isOnDevLocale()) { locale = buildFileLocale(getDevLocale()) diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 9c36b946e..5315c8b1d 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -221,7 +221,7 @@ export class AuthService { } refreshUserInformation () { - const obj = { + const obj: any = { access_token: this.user.getAccessToken(), refresh_token: null, token_type: this.user.getTokenType(), diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 2f1ef1fc2..1663a052c 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -155,7 +155,7 @@ export class ServerService { .pipe( switchMap(translations => { return this.http.get(ServerService.BASE_VIDEO_URL + attributeName) - .pipe(map(data => ({ data, translations }))) + .pipe(map((data: any) => ({ data, translations }))) }) ) .subscribe(({ data, translations }) => { diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index a6eef0898..50c19ecac 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts @@ -5,7 +5,7 @@ import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' export class ThemeService { private theme = document.querySelector('body') private darkTheme = false - private previousTheme = {} + private previousTheme: { [ id: string ]: string } = {} constructor () { // initialise the alternative theme with dark theme colors @@ -33,7 +33,7 @@ export class ThemeService { } } - private switchProperty (property, newValue?) { + private switchProperty (property: string, newValue?: string) { const propertyOldvalue = window.getComputedStyle(this.theme).getPropertyValue('--' + property) this.theme.style.setProperty('--' + property, (newValue) ? newValue : this.previousTheme[property]) this.previousTheme[property] = propertyOldvalue diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 95926f5f0..348700c09 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts @@ -18,7 +18,7 @@ export class MenuComponent implements OnInit { userHasAdminAccess = false helpVisible = false - private routesPerRight = { + private routesPerRight: any = { [UserRight.MANAGE_USERS]: '/admin/users', [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses', diff --git a/client/src/app/search/advanced-search.model.ts b/client/src/app/search/advanced-search.model.ts index 033fa9bba..1d6c89282 100644 --- a/client/src/app/search/advanced-search.model.ts +++ b/client/src/app/search/advanced-search.model.ts @@ -53,7 +53,7 @@ export class AdvancedSearch { } containsValues () { - const obj = this.toUrlObject() + const obj: any = this.toUrlObject() for (const k of Object.keys(obj)) { if (k === 'sort') continue // Exception @@ -113,7 +113,7 @@ export class AdvancedSearch { size () { let acc = 0 - const obj = this.toUrlObject() + const obj: any = this.toUrlObject() for (const k of Object.keys(obj)) { if (k === 'sort') continue // Exception diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts index 022ab5ee8..9877f639d 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ b/client/src/app/shared/buttons/action-dropdown.component.ts @@ -2,9 +2,9 @@ import { Component, Input } from '@angular/core' export type DropdownAction = { label?: string - handler?: (T) => any - linkBuilder?: (T) => (string | number)[] - isDisplayed?: (T) => boolean + handler?: (T: any) => any + linkBuilder?: (T: any) => (string | number)[] + isDisplayed?: (T: any) => boolean } @Component({ diff --git a/client/src/app/shared/buttons/button.component.ts b/client/src/app/shared/buttons/button.component.ts index 967cb1409..cccf98bc3 100644 --- a/client/src/app/shared/buttons/button.component.ts +++ b/client/src/app/shared/buttons/button.component.ts @@ -8,9 +8,9 @@ import { Component, Input } from '@angular/core' export class ButtonComponent { @Input() label = '' - @Input() className = undefined - @Input() icon = undefined - @Input() title = undefined + @Input() className: any = undefined + @Input() icon: any = undefined + @Input() title: any = undefined getTitle () { return this.title || this.label diff --git a/client/src/app/shared/buttons/edit-button.component.ts b/client/src/app/shared/buttons/edit-button.component.ts index 7abaacc26..ea552663a 100644 --- a/client/src/app/shared/buttons/edit-button.component.ts +++ b/client/src/app/shared/buttons/edit-button.component.ts @@ -8,5 +8,5 @@ import { Component, Input } from '@angular/core' export class EditButtonComponent { @Input() label: string - @Input() routerLink = [] + @Input() routerLink: any = [] } diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts index ba0452e77..ccce1ccfa 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/misc/help.component.ts @@ -60,7 +60,7 @@ export class HelpComponent implements OnInit, OnChanges { } private createMarkdownList (rules: string[]) { - const rulesToText = { + const rulesToText: any = { 'emphasis': this.i18n('Emphasis'), 'link': this.i18n('Links'), 'newline': this.i18n('New lines'), diff --git a/client/src/app/shared/misc/peertube-local-storage.ts b/client/src/app/shared/misc/peertube-local-storage.ts index 260f994b6..fb5c45acf 100644 --- a/client/src/app/shared/misc/peertube-local-storage.ts +++ b/client/src/app/shared/misc/peertube-local-storage.ts @@ -6,7 +6,7 @@ class MemoryStorage { [key: string]: any [index: number]: string - getItem (key) { + getItem (key: any) { const stringKey = String(key) if (valuesMap.has(key)) { return String(valuesMap.get(stringKey)) @@ -15,11 +15,11 @@ class MemoryStorage { return null } - setItem (key, val) { + setItem (key: any, val: any) { valuesMap.set(String(key), String(val)) } - removeItem (key) { + removeItem (key: any) { valuesMap.delete(key) } diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index c8b7ebc67..78be2e5dd 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts @@ -102,7 +102,7 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) { return fd } -function lineFeedToHtml (obj: object, keyToNormalize: string) { +function lineFeedToHtml (obj: any, keyToNormalize: string) { return immutableAssign(obj, { [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '
') }) diff --git a/client/src/app/shared/overview/videos-overview.model.ts b/client/src/app/shared/overview/videos-overview.model.ts index cf02bdb3d..c8eafc8e8 100644 --- a/client/src/app/shared/overview/videos-overview.model.ts +++ b/client/src/app/shared/overview/videos-overview.model.ts @@ -16,4 +16,5 @@ export class VideosOverview implements VideosOverviewServer { tag: string videos: Video[] }[] + [key: string]: any } diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts index 6492aa66d..934f6c618 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/shared/rest/rest-extractor.service.ts @@ -33,7 +33,7 @@ export class RestExtractor { return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ]) } - convertDateToHuman (target: object, fieldsToConvert: string[]) { + convertDateToHuman (target: any, fieldsToConvert: string[]) { fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field])) return target @@ -83,7 +83,7 @@ export class RestExtractor { errorMessage = err } - const errorObj = { + const errorObj: any = { message: errorMessage, status: undefined, body: undefined diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index 4560c2024..41824a18f 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts @@ -32,7 +32,7 @@ export class RestService { return newParams } - addObjectParams (params: HttpParams, object: object) { + addObjectParams (params: HttpParams, object: any) { for (const name of Object.keys(object)) { const value = object[name] if (!value) continue diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 7c840ffa7..e6b612054 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts @@ -43,6 +43,7 @@ export class User implements UserServerModel { blocked: boolean blockedReason?: string + [key: string]: any constructor (hash: UserConstructorHash) { this.id = hash.id diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 1f43f974c..87814d4ba 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -27,7 +27,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { sort: VideoSortField = '-publishedAt' categoryOneOf?: number defaultSort: VideoSortField = '-publishedAt' - syndicationItems = [] + syndicationItems: any = [] loadOnInit = true marginContent = true @@ -59,7 +59,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { private resizeSubscription: Subscription abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> - abstract generateSyndicationList () + abstract generateSyndicationList (): any get user () { return this.authService.getUser() @@ -209,7 +209,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { } protected setNewRouteParams () { - const paramsObject = this.buildRouteParams() + const paramsObject: any = this.buildRouteParams() const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') this.location.replaceState(this.currentRoute, queryParams) diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index 0046be964..a62277e04 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts @@ -25,6 +25,7 @@ export class VideoEdit implements VideoUpdate { uuid?: string id?: number scheduleUpdate?: VideoScheduleUpdate + [key: string]: any constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { if (video) { @@ -49,7 +50,7 @@ export class VideoEdit implements VideoUpdate { } } - patch (values: Object) { + patch (values: any) { Object.keys(values).forEach((key) => { this[ key ] = values[ key ] }) diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts index 6922153c0..be6c80c3f 100644 --- a/client/src/app/shared/video/video-feed.component.ts +++ b/client/src/app/shared/video/video-feed.component.ts @@ -6,5 +6,5 @@ import { Component, Input } from '@angular/core' templateUrl: './video-feed.component.html' }) export class VideoFeedComponent { - @Input() syndicationItems + @Input() syndicationItems: any } diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 724a0bde9..6283cf84d 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts @@ -276,7 +276,7 @@ export class VideoService implements VideosProvider { return this.authHttp .get(environment.apiUrl + descriptionPath) .pipe( - map(res => res[ 'description' ]), + map((res: any) => res[ 'description' ]), catchError(err => this.restExtractor.handleError(err)) ) } diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index 07c33030a..a2c9237ad 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts @@ -19,7 +19,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni @ViewChild('modal') modal: ElementRef - videoCaptionLanguages = [] + videoCaptionLanguages: any = [] private openedModal: NgbModalRef private closingModal = false @@ -73,7 +73,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni this.hide() const languageId = this.form.value[ 'language' ] - const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) + const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId) this.captionAdded.emit({ language: languageObject, diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index eb9396d70..a56733e57 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts @@ -48,7 +48,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { calendarTimezone: string calendarDateFormat: string - private schedulerInterval + private schedulerInterval: any private firstPatchDone = false private initialVideoCaptions: string[] = [] @@ -77,13 +77,13 @@ export class VideoEditComponent implements OnInit, OnDestroy { } updateForm () { - const defaultValues = { + const defaultValues: any = { nsfw: 'false', commentsEnabled: 'true', waitTranscoding: 'true', tags: [] } - const obj = { + const obj: any = { name: this.videoValidatorsService.VIDEO_NAME, privacy: this.videoValidatorsService.VIDEO_PRIVACY, channelId: this.videoValidatorsService.VIDEO_CHANNEL, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 0f7184ff8..9a50e2ab2 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('torrentfileInput') torrentfileInput + @ViewChild('torrentfileInput') torrentfileInput: any videoFileName: string magnetUri = '' diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 6d1bac3f2..cf9d47cbe 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo protected videoService: VideoService protected videoCaptionService: VideoCaptionService - abstract canDeactivate () + abstract canDeactivate (): any ngOnInit () { this.buildForm({}) diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 941dc5441..fa6ee0c23 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts @@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('videofileInput') videofileInput + @ViewChild('videofileInput') videofileInput: any // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 3f4072efd..9ad419a69 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core' import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' -import * as linkify from 'linkifyjs' -import * as linkifyHtml from 'linkifyjs/html' +const linkify = require('linkifyjs') +const linkifyHtml = require('linkifyjs/html') @Injectable() export class LinkifierService { @@ -40,7 +40,7 @@ export class LinkifierService { const TT_UNDERSCORE = TT.UNDERSCORE const TT_DOT = TT.DOT - function MENTION (value) { + function MENTION (value: any) { this.v = value } diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index fb7de0e04..ba3c0398e 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts @@ -76,7 +76,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { this.formValidated() } - openVisitorModal (event) { + openVisitorModal (event: any) { if (this.user === null) { // we only open it for visitors // fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error event.srcElement.blur() diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index e90008de9..982470786 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts @@ -26,7 +26,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { @Output() resetReply = new EventEmitter() sanitizedCommentHTML = '' - newParentComments = [] + newParentComments: any = [] constructor ( private linkifierService: LinkifierService, diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts index fe591811e..824fb24c3 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts @@ -14,7 +14,7 @@ export class VideoComment implements VideoCommentServerModel { account: AccountInterface totalReplies: number by: string - accountAvatarUrl + accountAvatarUrl: string constructor (hash: VideoCommentServerModel) { this.id = hash.id diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 9bcb4b7de..7d9c2d0ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts @@ -32,7 +32,7 @@ export class VideoCommentService { return this.authHttp.post(url, normalizedComment) .pipe( - map(data => this.extractVideoComment(data['comment'])), + map((data: any) => this.extractVideoComment(data['comment'])), catchError(err => this.restExtractor.handleError(err)) ) } @@ -43,7 +43,7 @@ export class VideoCommentService { return this.authHttp.post(url, normalizedComment) .pipe( - map(data => this.extractVideoComment(data[ 'comment' ])), + map((data: any) => this.extractVideoComment(data[ 'comment' ])), catchError(err => this.restExtractor.handleError(err)) ) } diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index c864d82b7..4c1bdf2dd 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts @@ -35,7 +35,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { threadComments: { [ id: number ]: VideoCommentThreadTree } = {} threadLoading: { [ id: number ]: boolean } = {} - syndicationItems = [] + syndicationItems: any = [] private sub: Subscription diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index c5deddf05..ed5e723c9 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -7,7 +7,7 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp import { MetaService } from '@ngx-meta/core' import { NotificationsService } from 'angular2-notifications' import { forkJoin, Subscription } from 'rxjs' -import * as videojs from 'video.js' +const videojs = require('video.js') import 'videojs-hotkeys' import { Hotkey, HotkeysService } from 'angular2-hotkeys' import * as WebTorrent from 'webtorrent' @@ -45,7 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent - player: videojs.Player + player: any playerElement: HTMLVideoElement userRating: UserVideoRateType = null video: VideoDetails = null @@ -435,7 +435,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.zone.runOutsideAngular(async () => { videojs(this.playerElement, videojsOptions, function () { self.player = this - this.on('customError', (event, data) => self.handleError(data.err)) + this.on('customError', (data: any) => self.handleError(data.err)) addContextMenu(self.player, self.video.embedUrl) }) @@ -448,7 +448,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.checkUserRating() } - private setRating (nextRating) { + private setRating (nextRating: string) { let method switch (nextRating) { case 'like': @@ -466,11 +466,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { .subscribe( () => { // Update the video like attribute - this.updateVideoRating(this.userRating, nextRating) - this.userRating = nextRating + this.updateVideoRating(this.userRating, nextRating as VideoRateType) + this.userRating = nextRating as UserVideoRateType }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + (err: any) => this.notificationsService.error(this.i18n('Error'), err.message) ) } -- cgit v1.2.3