diff --git a/src/stores/UIStore.ts b/src/stores/UIStore.ts index 86312f79d7..b89af2f7c0 100644 --- a/src/stores/UIStore.ts +++ b/src/stores/UIStore.ts @@ -15,7 +15,11 @@ limitations under the License. */ import EventEmitter from "events"; -import ResizeObserver from 'resize-observer-polyfill'; +// XXX: resize-observer-polyfill has types that now conflict with typescript's +// own DOM types: https://github.com/que-etc/resize-observer-polyfill/issues/80 +// Using require here rather than import is a horrenous workaround. We should +// be able to remove the polyfill once Safari 14 is released. +const ResizeObserverPolyfill = require('resize-observer-polyfill'); // eslint-disable-line @typescript-eslint/no-var-requires import ResizeObserverEntry from 'resize-observer-polyfill/src/ResizeObserverEntry'; export enum UI_EVENTS { @@ -43,7 +47,7 @@ export default class UIStore extends EventEmitter { // eslint-disable-next-line no-restricted-properties this.windowHeight = window.innerHeight; - this.resizeObserver = new ResizeObserver(this.resizeObserverCallback); + this.resizeObserver = new ResizeObserverPolyfill(this.resizeObserverCallback); this.resizeObserver.observe(document.body); } diff --git a/src/utils/PasswordScorer.ts b/src/utils/PasswordScorer.ts index e3c30c1680..9aae4039bd 100644 --- a/src/utils/PasswordScorer.ts +++ b/src/utils/PasswordScorer.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import zxcvbn from 'zxcvbn'; +import zxcvbn, { ZXCVBNFeedbackWarning } from 'zxcvbn'; import { MatrixClientPeg } from '../MatrixClientPeg'; import { _t, _td } from '../languageHandler'; @@ -84,7 +84,7 @@ export function scorePassword(password: string) { } // and warning, if any if (zxcvbnResult.feedback.warning) { - zxcvbnResult.feedback.warning = _t(zxcvbnResult.feedback.warning); + zxcvbnResult.feedback.warning = _t(zxcvbnResult.feedback.warning) as ZXCVBNFeedbackWarning; } return zxcvbnResult;