From b7cd0b1bf7ba9ac8b460ef2fa193877fa8453aab Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:20:08 -0500 Subject: [PATCH] Tidy up link previews types --- js/modules/link_previews.d.ts | 6 ++++++ ts/window.d.ts | 14 ++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/js/modules/link_previews.d.ts b/js/modules/link_previews.d.ts index 183bdb1cfd..cd1f10c773 100644 --- a/js/modules/link_previews.d.ts +++ b/js/modules/link_previews.d.ts @@ -1,3 +1,9 @@ export function isLinkSafeToPreview(link: string): boolean; +export function findLinks(text: string, caretLocation?: number): Array; + +export function getDomain(href: string): string; + export function isLinkSneaky(link: string): boolean; + +export function isStickerPack(href: string): boolean; diff --git a/ts/window.d.ts b/ts/window.d.ts index 08d470aad5..5cce8b4ad0 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -3,6 +3,7 @@ import * as Backbone from 'backbone'; import * as Underscore from 'underscore'; import { Ref } from 'react'; +import * as LinkPreviews from '../js/modules/link_previews.d'; import * as Util from './util'; import { ConversationModelCollectionType, @@ -358,18 +359,7 @@ declare global { VisualAttachment: any; }; Util: typeof Util; - LinkPreviews: { - isMediaLinkInWhitelist: any; - getTitleMetaTag: any; - getImageMetaTag: any; - assembleChunks: any; - getChunkPattern: any; - isLinkInWhitelist: any; - isStickerPack: (url: string) => boolean; - isLinkSafeToPreview: (url: string) => boolean; - findLinks: (body: string, unknown?: any) => Array; - getDomain: (url: string) => string; - }; + LinkPreviews: typeof LinkPreviews; GroupChange: { renderChange: (change: unknown, things: unknown) => Array; };