Skip to content

Commit

Permalink
Clean up Element#scrollIntoViewIfNeeded type
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal committed Feb 25, 2022
1 parent 033b483 commit e4b4a0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
11 changes: 1 addition & 10 deletions ts/quill/mentions/completion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

import _ from 'lodash';
Expand Down Expand Up @@ -27,15 +27,6 @@ export type MentionCompletionOptions = {
theme: ThemeType;
};

declare global {
// We want to extend `HTMLElement`'s properties, so we need an interface.
// eslint-disable-next-line no-restricted-syntax
interface HTMLElement {
// Webkit-specific
scrollIntoViewIfNeeded: (bringToCenter: boolean) => void;
}
}

const MENTION_REGEX = /(?:^|\W)@([-+\w]*)$/;

export class MentionCompletion {
Expand Down
7 changes: 7 additions & 0 deletions ts/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,13 @@ declare global {
stackForLog?: string;
}

// We want to extend `Element`'s properties, so we need an interface.
// eslint-disable-next-line no-restricted-syntax
interface Element {
// WebKit-specific
scrollIntoViewIfNeeded: (bringToCenter?: boolean) => void;
}

// Uint8Array and ArrayBuffer are type-compatible in TypeScript's covariant
// type checker, but in reality they are not. Let's assert correct use!
interface Uint8Array {
Expand Down

0 comments on commit e4b4a0c

Please sign in to comment.