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 --- .../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 +++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'client/src/app/videos/+video-watch') 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