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 --- client/src/app/shared/video/video-edit.model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared/video/video-edit.model.ts') 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 ] }) -- cgit v1.2.3 From c199c427d4ae586339822320f20f512a7a19dc3f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 14:35:31 +0200 Subject: Better typings --- client/src/app/shared/video/video-edit.model.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/video/video-edit.model.ts') diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index a62277e04..fc772a3cf 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts @@ -25,7 +25,6 @@ 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) { @@ -50,14 +49,14 @@ export class VideoEdit implements VideoUpdate { } } - patch (values: any) { + patch (values: { [ id: string ]: string }) { Object.keys(values).forEach((key) => { this[ key ] = values[ key ] }) // If schedule publication, the video is private and will be changed to public privacy if (parseInt(values['privacy'], 10) === VideoEdit.SPECIAL_SCHEDULED_PRIVACY) { - const updateAt = (values['schedulePublicationAt'] as Date) + const updateAt = new Date(values['schedulePublicationAt']) updateAt.setSeconds(0) this.privacy = VideoPrivacy.PRIVATE -- cgit v1.2.3