Add zipkin javascript opentracing types (#27330)

* Added type definitions for zipkin-javascript-opentracing

* Added type definitions for zipkin-javascript-opentracing

* update import
This commit is contained in:
Laurent Gilly 2018-07-23 19:33:20 +02:00 committed by Andy
parent 250972049c
commit fecb03bc20
4 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,50 @@
// Type definitions for zipkin-javascript-opentracing 1.6
// Project: https://github.com/DanielMSchmidt/zipkin-javascript-opentracing
// Definitions by: Laurent Gilly <https://github.com/laurentgilly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = zipkin_javascript_opentracing;
declare class zipkin_javascript_opentracing {
constructor(...args: any[]);
extract(format: any, carrier: any): any;
inject(span: any, format: any, carrier: any): void;
startSpan(name: any, ...args: any[]): any;
static FORMAT_BINARY: string;
static FORMAT_HTTP_HEADERS: string;
static FORMAT_TEXT_MAP: string;
static makeOptional(val: any): any;
}
declare namespace zipkin_javascript_opentracing {
namespace makeOptionalNamespace {
const prototype: {};
}
namespace prototypeNamespace {
function extract(format: any, carrier: any): any;
function inject(span: any, format: any, carrier: any): void;
function startSpan(name: any, ...args: any[]): any;
namespace extract {
const prototype: {};
}
namespace inject {
const prototype: {};
}
namespace startSpan {
const prototype: {};
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,9 @@
import ZipkinOpentracing = require("zipkin-javascript-opentracing");
const zipkinBaseUrl = "http://zipkin.danielmschmidt.de";
// Setup the tracer
const tracer = new ZipkinOpentracing({
serviceName: "zipkin-opentracing-service",
endpoint: zipkinBaseUrl,
kind: "client"
});