summaryrefslogtreecommitdiff
path: root/client/simple/src/js/util/assertElement.ts
blob: a362fcf8f76f60a890532a298dc9325e0702ec19 (plain)
1
2
3
4
5
6
7
8
// SPDX-License-Identifier: AGPL-3.0-or-later

type AssertElement = <T>(element?: T | null) => asserts element is T;
export const assertElement: AssertElement = <T>(element?: T | null): asserts element is T => {
  if (!element) {
    throw new Error("DOM element not found");
  }
};