diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index fe4a7bca8d..83f185de61 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -1,6 +1,5 @@ # autogenerated file: run scripts/generate-eslint-error-ignore-file to update. -src/ImageUtils.js src/Markdown.js src/Rooms.js src/Unread.js diff --git a/src/ImageUtils.js b/src/ImageUtils.ts similarity index 90% rename from src/ImageUtils.js rename to src/ImageUtils.ts index c0f7b94b81..9bfab37193 100644 --- a/src/ImageUtils.js +++ b/src/ImageUtils.ts @@ -1,5 +1,5 @@ /* -Copyright 2015, 2016 OpenMarket Ltd +Copyright 2015, 2016, 2020 Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - /** * Returns the actual height that an image of dimensions (fullWidth, fullHeight) * will occupy if resized to fit inside a thumbnail bounding box of size @@ -30,11 +28,11 @@ limitations under the License. * consume in the timeline, when performing scroll offset calcuations * (e.g. scroll locking) */ -export function thumbHeight(fullWidth, fullHeight, thumbWidth, thumbHeight) { +export function thumbHeight(fullWidth: number, fullHeight: number, thumbWidth: number, thumbHeight: number) { if (!fullWidth || !fullHeight) { // Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even // log this because it's spammy - return undefined; + return null; } if (fullWidth < thumbWidth && fullHeight < thumbHeight) { // no scaling needs to be applied