From 7d48788b2c37a4f7f49b150ae3a8828482df8c8d Mon Sep 17 00:00:00 2001 From: Maxim Schuwalow <16665913+mschuwalow@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:00:24 +0200 Subject: [PATCH] [No Ticket] Fix tiny hashes import when building with webpack (#220) --- src/typings/tiny-hashes.d.ts | 13 ++++--------- src/typings/window.d.ts | 6 +++--- src/utils/hash.ts | 4 +--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/typings/tiny-hashes.d.ts b/src/typings/tiny-hashes.d.ts index 3074a19b..6731d33f 100644 --- a/src/typings/tiny-hashes.d.ts +++ b/src/typings/tiny-hashes.d.ts @@ -1,11 +1,6 @@ -declare module 'tiny-hashes/md5' { - export default function md5(str: string): string -} - -declare module 'tiny-hashes/sha1' { - export default function sha1(str: string): string -} +declare module 'tiny-hashes/dist' { + export function md5(str: string): string + export function sha1(str: string): string + export function sha256(str: string): string -declare module 'tiny-hashes/sha256' { - export default function sha256(str: string): string } diff --git a/src/typings/window.d.ts b/src/typings/window.d.ts index 09d3912e..3bdd4497 100644 --- a/src/typings/window.d.ts +++ b/src/typings/window.d.ts @@ -1,4 +1,4 @@ -import { ILiveConnect } from '../types' +import { InternalLiveConnect } from '../types' declare global { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -6,8 +6,8 @@ declare global { interface Window { // eslint-disable-next-line camelcase - liQ_instances?: ILiveConnect[] - liQ?: ILiveConnect | unknown[] + liQ_instances?: InternalLiveConnect[] + liQ?: InternalLiveConnect | unknown[] XDomainRequest?: { new(): XDomainRequest; prototype: XDomainRequest; create(): XDomainRequest }; // for IE compat [k: string]: unknown // allow accessing arbitrary fields msCrypto: Crypto diff --git a/src/utils/hash.ts b/src/utils/hash.ts index b5ab56a2..23334158 100644 --- a/src/utils/hash.ts +++ b/src/utils/hash.ts @@ -1,6 +1,4 @@ -import md5 from 'tiny-hashes/md5' -import sha1 from 'tiny-hashes/sha1' -import sha256 from 'tiny-hashes/sha256' +import { md5, sha1, sha256 } from 'tiny-hashes/dist' import { HashedEmail } from '../types' import { trim } from 'live-connect-common'