@@ -224,31 +224,54 @@ export function getActiveSpan(): Span | undefined {
224224 return getCurrentScope ( ) . getSpan ( ) ;
225225}
226226
227- export function continueTrace ( {
228- sentryTrace,
229- baggage,
230- } : {
231- sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
232- baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
233- } ) : Partial < TransactionContext > ;
234- export function continueTrace < V > (
235- {
227+ interface ContinueTrace {
228+ /**
229+ * Continue a trace from `sentry-trace` and `baggage` values.
230+ * These values can be obtained from incoming request headers,
231+ * or in the browser from `<meta name="sentry-trace">` and `<meta name="baggage">` HTML tags.
232+ *
233+ * @deprecated Use the version of this function taking a callback as second parameter instead:
234+ *
235+ * ```
236+ * Sentry.continueTrace(sentryTrace: '...', baggage: '...' }, () => {
237+ * // ...
238+ * })
239+ * ```
240+ *
241+ */
242+ ( {
236243 sentryTrace,
237244 baggage,
238245 } : {
239246 sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
240247 baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
241- } ,
242- callback : ( transactionContext : Partial < TransactionContext > ) => V ,
243- ) : V ;
244- /**
245- * Continue a trace from `sentry-trace` and `baggage` values.
246- * These values can be obtained from incoming request headers,
247- * or in the browser from `<meta name="sentry-trace">` and `<meta name="baggage">` HTML tags.
248- *
249- * The callback receives a transactionContext that may be used for `startTransaction` or `startSpan`.
250- */
251- export function continueTrace < V > (
248+ } ) : Partial < TransactionContext > ;
249+
250+ /**
251+ * Continue a trace from `sentry-trace` and `baggage` values.
252+ * These values can be obtained from incoming request headers, or in the browser from `<meta name="sentry-trace">`
253+ * and `<meta name="baggage">` HTML tags.
254+ *
255+ * Spans started with `startSpan`, `startSpanManual` and `startInactiveSpan`, within the callback will automatically
256+ * be attached to the incoming trace.
257+ *
258+ * Deprecation notice: In the next major version of the SDK the provided callback will not receive a transaction
259+ * context argument.
260+ */
261+ < V > (
262+ {
263+ sentryTrace,
264+ baggage,
265+ } : {
266+ sentryTrace : Parameters < typeof tracingContextFromHeaders > [ 0 ] ;
267+ baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
268+ } ,
269+ // TODO(v8): Remove parameter from this callback.
270+ callback : ( transactionContext : Partial < TransactionContext > ) => V ,
271+ ) : V ;
272+ }
273+
274+ export const continueTrace : ContinueTrace = < V > (
252275 {
253276 sentryTrace,
254277 baggage,
@@ -257,7 +280,7 @@ export function continueTrace<V>(
257280 baggage : Parameters < typeof tracingContextFromHeaders > [ 1 ] ;
258281 } ,
259282 callback ?: ( transactionContext : Partial < TransactionContext > ) => V ,
260- ) : V | Partial < TransactionContext > {
283+ ) : V | Partial < TransactionContext > => {
261284 const currentScope = getCurrentScope ( ) ;
262285
263286 const { traceparentData, dynamicSamplingContext, propagationContext } = tracingContextFromHeaders (
@@ -283,7 +306,7 @@ export function continueTrace<V>(
283306 }
284307
285308 return callback ( transactionContext ) ;
286- }
309+ } ;
287310
288311function createChildSpanOrTransaction (
289312 hub : Hub ,
0 commit comments