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/assets/player/video-renderer.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'client/src/assets/player/video-renderer.ts') diff --git a/client/src/assets/player/video-renderer.ts b/client/src/assets/player/video-renderer.ts index 2cb05a448..a3415937b 100644 --- a/client/src/assets/player/video-renderer.ts +++ b/client/src/assets/player/video-renderer.ts @@ -1,9 +1,9 @@ // Thanks: https://github.com/feross/render-media // TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed -import * as MediaElementWrapper from 'mediasource' +const MediaElementWrapper = require('mediasource') import { extname } from 'path' -import * as videostream from 'videostream' +const videostream = require('videostream') const VIDEOSTREAM_EXTS = [ '.m4a', @@ -17,7 +17,7 @@ type RenderMediaOptions = { } function renderVideo ( - file, + file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer: any) => void @@ -27,11 +27,11 @@ function renderVideo ( return renderMedia(file, elem, opts, callback) } -function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { +function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { const extension = extname(file.name).toLowerCase() - let preparedElem = undefined + let preparedElem: any = undefined let currentTime = 0 - let renderer + let renderer: any try { if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) { @@ -45,7 +45,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca function useVideostream () { prepareElem() - preparedElem.addEventListener('error', function onError (err) { + preparedElem.addEventListener('error', function onError (err: Error) { preparedElem.removeEventListener('error', onError) return callback(err) @@ -58,7 +58,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca const codecs = getCodec(file.name, useVP9) prepareElem() - preparedElem.addEventListener('error', function onError (err) { + preparedElem.addEventListener('error', function onError (err: Error) { preparedElem.removeEventListener('error', onError) // Try with vp9 before returning an error @@ -102,7 +102,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca } } -function validateFile (file) { +function validateFile (file: any) { if (file == null) { throw new Error('file cannot be null or undefined') } -- cgit v1.2.3