diff options
author | BO41 <lukasw41@gmail.com> | 2018-10-18 09:08:59 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2018-10-18 09:08:59 +0200 |
commit | 244b4ae3973bc1511464a08158a123767f83179c (patch) | |
tree | 24f4399489167bc92921e3fe0c1c04a87d7c1161 /client/src/app/shared | |
parent | 28e51e831bd121f063600a597d7b02f8fd846de9 (diff) | |
download | PeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.gz PeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.zst PeerTube-244b4ae3973bc1511464a08158a123767f83179c.zip |
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
Diffstat (limited to 'client/src/app/shared')
14 files changed, 24 insertions, 21 deletions
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' | |||
2 | 2 | ||
3 | export type DropdownAction<T> = { | 3 | export type DropdownAction<T> = { |
4 | label?: string | 4 | label?: string |
5 | handler?: (T) => any | 5 | handler?: (T: any) => any |
6 | linkBuilder?: (T) => (string | number)[] | 6 | linkBuilder?: (T: any) => (string | number)[] |
7 | isDisplayed?: (T) => boolean | 7 | isDisplayed?: (T: any) => boolean |
8 | } | 8 | } |
9 | 9 | ||
10 | @Component({ | 10 | @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' | |||
8 | 8 | ||
9 | export class ButtonComponent { | 9 | export class ButtonComponent { |
10 | @Input() label = '' | 10 | @Input() label = '' |
11 | @Input() className = undefined | 11 | @Input() className: any = undefined |
12 | @Input() icon = undefined | 12 | @Input() icon: any = undefined |
13 | @Input() title = undefined | 13 | @Input() title: any = undefined |
14 | 14 | ||
15 | getTitle () { | 15 | getTitle () { |
16 | return this.title || this.label | 16 | 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' | |||
8 | 8 | ||
9 | export class EditButtonComponent { | 9 | export class EditButtonComponent { |
10 | @Input() label: string | 10 | @Input() label: string |
11 | @Input() routerLink = [] | 11 | @Input() routerLink: any = [] |
12 | } | 12 | } |
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 { | |||
60 | } | 60 | } |
61 | 61 | ||
62 | private createMarkdownList (rules: string[]) { | 62 | private createMarkdownList (rules: string[]) { |
63 | const rulesToText = { | 63 | const rulesToText: any = { |
64 | 'emphasis': this.i18n('Emphasis'), | 64 | 'emphasis': this.i18n('Emphasis'), |
65 | 'link': this.i18n('Links'), | 65 | 'link': this.i18n('Links'), |
66 | 'newline': this.i18n('New lines'), | 66 | '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 { | |||
6 | [key: string]: any | 6 | [key: string]: any |
7 | [index: number]: string | 7 | [index: number]: string |
8 | 8 | ||
9 | getItem (key) { | 9 | getItem (key: any) { |
10 | const stringKey = String(key) | 10 | const stringKey = String(key) |
11 | if (valuesMap.has(key)) { | 11 | if (valuesMap.has(key)) { |
12 | return String(valuesMap.get(stringKey)) | 12 | return String(valuesMap.get(stringKey)) |
@@ -15,11 +15,11 @@ class MemoryStorage { | |||
15 | return null | 15 | return null |
16 | } | 16 | } |
17 | 17 | ||
18 | setItem (key, val) { | 18 | setItem (key: any, val: any) { |
19 | valuesMap.set(String(key), String(val)) | 19 | valuesMap.set(String(key), String(val)) |
20 | } | 20 | } |
21 | 21 | ||
22 | removeItem (key) { | 22 | removeItem (key: any) { |
23 | valuesMap.delete(key) | 23 | valuesMap.delete(key) |
24 | } | 24 | } |
25 | 25 | ||
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) { | |||
102 | return fd | 102 | return fd |
103 | } | 103 | } |
104 | 104 | ||
105 | function lineFeedToHtml (obj: object, keyToNormalize: string) { | 105 | function lineFeedToHtml (obj: any, keyToNormalize: string) { |
106 | return immutableAssign(obj, { | 106 | return immutableAssign(obj, { |
107 | [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />') | 107 | [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />') |
108 | }) | 108 | }) |
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 { | |||
16 | tag: string | 16 | tag: string |
17 | videos: Video[] | 17 | videos: Video[] |
18 | }[] | 18 | }[] |
19 | [key: string]: any | ||
19 | } | 20 | } |
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 { | |||
33 | return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ]) | 33 | return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ]) |
34 | } | 34 | } |
35 | 35 | ||
36 | convertDateToHuman (target: object, fieldsToConvert: string[]) { | 36 | convertDateToHuman (target: any, fieldsToConvert: string[]) { |
37 | fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field])) | 37 | fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field])) |
38 | 38 | ||
39 | return target | 39 | return target |
@@ -83,7 +83,7 @@ export class RestExtractor { | |||
83 | errorMessage = err | 83 | errorMessage = err |
84 | } | 84 | } |
85 | 85 | ||
86 | const errorObj = { | 86 | const errorObj: any = { |
87 | message: errorMessage, | 87 | message: errorMessage, |
88 | status: undefined, | 88 | status: undefined, |
89 | body: undefined | 89 | 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 { | |||
32 | return newParams | 32 | return newParams |
33 | } | 33 | } |
34 | 34 | ||
35 | addObjectParams (params: HttpParams, object: object) { | 35 | addObjectParams (params: HttpParams, object: any) { |
36 | for (const name of Object.keys(object)) { | 36 | for (const name of Object.keys(object)) { |
37 | const value = object[name] | 37 | const value = object[name] |
38 | if (!value) continue | 38 | 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 { | |||
43 | 43 | ||
44 | blocked: boolean | 44 | blocked: boolean |
45 | blockedReason?: string | 45 | blockedReason?: string |
46 | [key: string]: any | ||
46 | 47 | ||
47 | constructor (hash: UserConstructorHash) { | 48 | constructor (hash: UserConstructorHash) { |
48 | this.id = hash.id | 49 | 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 { | |||
27 | sort: VideoSortField = '-publishedAt' | 27 | sort: VideoSortField = '-publishedAt' |
28 | categoryOneOf?: number | 28 | categoryOneOf?: number |
29 | defaultSort: VideoSortField = '-publishedAt' | 29 | defaultSort: VideoSortField = '-publishedAt' |
30 | syndicationItems = [] | 30 | syndicationItems: any = [] |
31 | 31 | ||
32 | loadOnInit = true | 32 | loadOnInit = true |
33 | marginContent = true | 33 | marginContent = true |
@@ -59,7 +59,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
59 | private resizeSubscription: Subscription | 59 | private resizeSubscription: Subscription |
60 | 60 | ||
61 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> | 61 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> |
62 | abstract generateSyndicationList () | 62 | abstract generateSyndicationList (): any |
63 | 63 | ||
64 | get user () { | 64 | get user () { |
65 | return this.authService.getUser() | 65 | return this.authService.getUser() |
@@ -209,7 +209,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
209 | } | 209 | } |
210 | 210 | ||
211 | protected setNewRouteParams () { | 211 | protected setNewRouteParams () { |
212 | const paramsObject = this.buildRouteParams() | 212 | const paramsObject: any = this.buildRouteParams() |
213 | 213 | ||
214 | const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') | 214 | const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') |
215 | this.location.replaceState(this.currentRoute, queryParams) | 215 | 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 { | |||
25 | uuid?: string | 25 | uuid?: string |
26 | id?: number | 26 | id?: number |
27 | scheduleUpdate?: VideoScheduleUpdate | 27 | scheduleUpdate?: VideoScheduleUpdate |
28 | [key: string]: any | ||
28 | 29 | ||
29 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { | 30 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { |
30 | if (video) { | 31 | if (video) { |
@@ -49,7 +50,7 @@ export class VideoEdit implements VideoUpdate { | |||
49 | } | 50 | } |
50 | } | 51 | } |
51 | 52 | ||
52 | patch (values: Object) { | 53 | patch (values: any) { |
53 | Object.keys(values).forEach((key) => { | 54 | Object.keys(values).forEach((key) => { |
54 | this[ key ] = values[ key ] | 55 | this[ key ] = values[ key ] |
55 | }) | 56 | }) |
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' | |||
6 | templateUrl: './video-feed.component.html' | 6 | templateUrl: './video-feed.component.html' |
7 | }) | 7 | }) |
8 | export class VideoFeedComponent { | 8 | export class VideoFeedComponent { |
9 | @Input() syndicationItems | 9 | @Input() syndicationItems: any |
10 | } | 10 | } |
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 { | |||
276 | return this.authHttp | 276 | return this.authHttp |
277 | .get(environment.apiUrl + descriptionPath) | 277 | .get(environment.apiUrl + descriptionPath) |
278 | .pipe( | 278 | .pipe( |
279 | map(res => res[ 'description' ]), | 279 | map((res: any) => res[ 'description' ]), |
280 | catchError(err => this.restExtractor.handleError(err)) | 280 | catchError(err => this.restExtractor.handleError(err)) |
281 | ) | 281 | ) |
282 | } | 282 | } |