From fd0eb4f0226ec2789e84023091c6f804f79519b3 Mon Sep 17 00:00:00 2001 From: Aliaksei Astafyeu Date: Sun, 12 Nov 2023 16:03:45 +0100 Subject: [PATCH] fix typescripy error --- src/discovery/PrintersDiscovery.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/discovery/PrintersDiscovery.tsx b/src/discovery/PrintersDiscovery.tsx index 291c0f6..f94e834 100644 --- a/src/discovery/PrintersDiscovery.tsx +++ b/src/discovery/PrintersDiscovery.tsx @@ -22,7 +22,7 @@ import { const { EscPosPrinterDiscovery } = NativeModules; const discoveryEventEmmiter = new NativeEventEmitter(EscPosPrinterDiscovery); -export const PrintersDiscovery = new (class PrintersDiscovery { +class PrintersDiscoveryClass { timeout: ReturnType | null = null; status: DiscoveryStatus = 'inactive'; statusListeners: ((status: DiscoveryStatus) => void)[] = []; @@ -149,4 +149,10 @@ export const PrintersDiscovery = new (class PrintersDiscovery { this.status = status; this.triggerStatusChange(status); }; -})(); +} + +function initPrintersClass() { + return new PrintersDiscoveryClass(); +} + +export const PrintersDiscovery = initPrintersClass();