From 4e421e72fec0f961af2a1130ca171fc492a34c48 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 23 Aug 2025 19:42:20 +0700 Subject: [PATCH] Main d.ts: replace hardcoded type def with enum values --- src/main/ua-parser.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/ua-parser.d.ts b/src/main/ua-parser.d.ts index 088d2b0..9d49448 100644 --- a/src/main/ua-parser.d.ts +++ b/src/main/ua-parser.d.ts @@ -3,6 +3,7 @@ // Definitions by: Faisal Salman import type { Headers } from "undici"; +import { BrowserType, CPU as CPUArch, Device as DeviceType, Engine as EngineName } from "../enums/ua-parser-enums"; declare namespace UAParser { @@ -17,21 +18,21 @@ declare namespace UAParser { name?: string; version?: string; major?: string; - type?: 'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'library'; + type?: typeof BrowserType[keyof typeof BrowserType]; } interface ICPU extends IData { - architecture?: 'ia32' | 'ia64' | 'amd64' | 'arm' | 'arm64' | 'armhf' | 'avr' | 'avr32' | 'irix' | 'irix64' | 'mips' | 'mips64' | '68k' | 'pa-risc' | 'ppc' | 'sparc' | 'sparc64'; + architecture?: typeof CPUArch[keyof typeof CPUArch]; } interface IDevice extends IData { - type?: 'mobile' | 'tablet' | 'console' | 'smarttv' | 'wearable' | 'xr' | 'embedded'; + type?: typeof DeviceType[keyof typeof DeviceType]; vendor?: string; model?: string; } interface IEngine extends IData { - name?: 'Amaya' | 'ArkWeb' | 'Blink' | 'EdgeHTML' | 'Flow' | 'Gecko' | 'Goanna' | 'iCab' | 'KHTML' | 'LibWeb' | 'Links' | 'Lynx' | 'NetFront' | 'NetSurf' | 'Presto' | 'Servo' | 'Tasman' | 'Trident' | 'w3m' | 'WebKit'; + name?: typeof EngineName[keyof typeof EngineName]; version?: string; }