Open mo22 opened 3 years ago
Hi,
maybe you want to add a d.ts typing file (package.json "typing": "index.d.ts")
declare module 'react-native-zeroconf' { import { EventEmitter } from 'events'; export interface PendingService { name: string; } export interface Service { name: string; port: number; txt: { [key: string]: string; }; addresses: string[]; fullName: string; host: string; } export default class Zeroconf extends EventEmitter { public getServices(): { [name: string]: Service | PendingService; }; public scan(type?: string, protocol?: string, domain?: string, implType?: 'NSD' | 'DNSSD'): void; public stop(implType?: 'NSD' | 'DNSSD'): void; public publishService(type: string, protocol: string, domain?: string, name?: Service['name'], port?: Service['port'], txt?: Service['txt'], implType?: 'NSD' | 'DNSSD'): void; public unpublishService(name: string, implType?: 'NSD' | 'DNSSD'): void; public on(event: 'start', listener: () => void): this; public on(event: 'stop', listener: () => void): this; public on(event: 'error', listener: (error: any) => void): this; public on(event: 'update', listener: () => void): this; public on(event: 'found', listener: (name: string) => void): this; public on(event: 'remove', listener: (name: string) => void): this; public on(event: 'resolved', listener: (service: Service) => void): this; public on(event: 'published', listener: (service: Service) => void): this; public on(event: 'unpublished', listener: (service: Service) => void): this; // addListener, once, etc? } }
I don't deal with typings as I don't use them, usually people do PRs on the repos I maintain and I merge them, so feel free! 🙂
I realize this is old, but @types/react-native-zeroconf exists
Hi,
maybe you want to add a d.ts typing file (package.json "typing": "index.d.ts")