Add types for dnssd (#24760)

* Added types for dnssd

* Cosmetics, test passed

* Removed unused rules
This commit is contained in:
Angel Merino
2018-04-09 18:56:02 +02:00
committed by Mohamed Hegazy
parent 6fda8a5f9d
commit ad0637bfe3
4 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import * as dnssd from 'dnssd';
const serviceType = new dnssd.ServiceType(dnssd.tcp('_mqtt'), dnssd.udp('_mqtt'));
const advertisement = new dnssd.Advertisement(serviceType, 1883, { name: 'broker' });
const browser: dnssd.Browser = new dnssd.Browser(serviceType);

58
types/dnssd/index.d.ts vendored Normal file
View File

@@ -0,0 +1,58 @@
// Type definitions for dnssd 0.3
// Project: https://github.com/DeMille/dnssd.js#readme
// Definitions by: Angel Merino <https://github.com/angelmerino>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/** Declaration file generated by dts-gen */
export class Advertisement {
constructor(type: any, port: any, ...args: any[]);
start(): any;
stop(forceImmediate: any, callback: any): void;
updateTXT(txtObj: any): void;
}
export class Browser {
constructor(type: any, ...args: any[]);
list(): any;
start(): any;
stop(): any;
}
export class ServiceType {
constructor(...args: any[]);
toString(): any;
static all(): any;
static tcp(...args: any[]): any;
static udp(...args: any[]): any;
}
export const resolveA: any;
export const resolveAAAA: any;
export function all(): any;
export function resolve(name: any, type: any, ...args: any[]): any;
export function resolveSRV(name: any, opts: any): any;
export function resolveService(name: any, ...args: any[]): any;
export function resolveTXT(name: any, opts: any): any;
export function tcp(...args: any[]): any;
export function udp(...args: any[]): any;

23
types/dnssd/tsconfig.json Normal file
View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dnssd-tests.ts"
]
}

1
types/dnssd/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }