From 08a2ff63fcfe8f10ea14e54824d4cde5387c3811 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 28 Nov 2020 02:08:52 +0100 Subject: [PATCH] Replace type cast with type assertion. --- static/sfu.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/sfu.js b/static/sfu.js index fc2f2a3..90bfed4 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -533,7 +533,9 @@ getInputElement('activitybox').onchange = function(e) { } getInputElement('fileinput').onchange = function(e) { - let input = /** @type{HTMLInputElement} */(this); + if(!(this instanceof HTMLInputElement)) + throw new Error('Unexpected type for this'); + let input = this; let files = input.files; for(let i = 0; i < files.length; i++) addFileMedia(files[i]);