File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Tracer {
1313 if ( result . done || result . value == null ) {
1414 throw new Error ( 'Unexpected end of id generator' ) ;
1515 }
16- return result . value . toMultibase ( 'base32hex' ) ;
16+ return result . value . toMultibase ( 'base32hex' ) as SpanId ;
1717 }
1818
1919 protected queueSpanEvent ( evt : SpanEvent ) {
@@ -46,7 +46,7 @@ class Tracer {
4646
4747 public async traced < T > (
4848 name : string ,
49- parentSpanId : string | undefined ,
49+ parentSpanId : SpanId | undefined ,
5050 fn : ( ) => T | Promise < T > ,
5151 ) : Promise < T > {
5252 const fnProm = async ( ) => {
Original file line number Diff line number Diff line change 1- type SpanId = string ;
1+ type SpanId = string & { readonly brand : unique symbol } ;
22
33/**
44 * A span is a virtual concept, not an actual object. A span is made up of
Original file line number Diff line number Diff line change 1+ import type { SpanId } from '#tracer/index.js' ;
12import fs from 'fs' ;
23import * as fc from 'fast-check' ;
34import tracer from '#tracer/index.js' ;
45
56let parentIndex = 0 ;
67let step = 0 ;
7- let nestedIds : Array < string > = [ ] ;
8+ let nestedIds : Array < SpanId > = [ ] ;
89
910type Flags = {
1011 hasForkA : boolean ;
@@ -18,9 +19,9 @@ type Flags = {
1819} ;
1920
2021const current : {
21- parentId ?: string ;
22- forkAId ?: string ;
23- forkBId ?: string ;
22+ parentId ?: SpanId ;
23+ forkAId ?: SpanId ;
24+ forkBId ?: SpanId ;
2425 flags : Flags ;
2526} = {
2627 flags : {
You can’t perform that action at this time.
0 commit comments