lightstep / lightstep-tracer-javascript

Lightstep distributed tracing library for Node.js and the browser
https://lightstep.com
MIT License
77 stars 66 forks source link

fix(ts-defs): adding ts defs #168

Closed marmaladebacon closed 5 years ago

marmaladebacon commented 5 years ago

From https://github.com/lightstep/lightstep-tracer-javascript/issues/99#issuecomment-516809657 Adding the TS definitions provided by felixfbecker with minor additions.

New to definition files so comments and suggestions would be welcome.

marmaladebacon commented 5 years ago

any update on this?

austinlparker commented 5 years ago

Seems fine, but is there more that should be added? Seems like it's just the tracer options.

marmaladebacon commented 5 years ago

Hi @austinlparker , actually I am wondering if I should just have the tracer options and the constructor for tracer typed since only the Tracer is exported https://github.com/lightstep/lightstep-tracer-javascript/blob/master/src/lib.js#L4, and for everything else shouldn't we be using the typings from https://github.com/opentracing/opentracing-javascript for compatibility with the opentracing api?

For Tracer, Span, SpanContext they already have that typed out.

Apologies if i'm missing something obvious here.

austinlparker commented 5 years ago

Yeah, that makes sense. I'm not super familiar with adding typings to a JS project, do they automatically get inherited?

edit - by 'they' i mean the typings from opentracing-javascript

marmaladebacon commented 5 years ago

I believe they do, from https://www.typescriptlang.org/docs/handbook/declaration-merging.html

“declaration merging” means that the compiler merges two separate declarations declared with the same name into a single definition. This merged definition has the features of both of the original declarations.

image

image

The additions from this PR image

The startSpan typing from opentracing: image

marmaladebacon commented 5 years ago

I've also added a ^to the version for opentracing so that it can be kept in sync with projects using ^0.14.x opentracing.

marmaladebacon commented 5 years ago

Many thanks for approving this @austinlparker! is there a known release date for the next version of lightstep-tracer-javascript?

austinlparker commented 5 years ago

Probably later this week or early next week.

austinlparker commented 5 years ago

This change was released in v0.22.1, out today.