Skip to content

Commit 61999e5

Browse files
committed
chore: remove withAsync from ContextManager interface
1 parent 4c1f013 commit 61999e5

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

packages/opentelemetry-context-base/src/NoopContextManager.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ export class NoopContextManager implements types.ContextManager {
2222
return Context.ROOT_CONTEXT;
2323
}
2424

25-
with(context: Context, fn: Function) {
26-
return fn();
27-
}
28-
29-
withAsync(context: Context, fn: Function) {
25+
with<T extends (...args: unknown[]) => ReturnType<T>>(
26+
context: Context,
27+
fn: T
28+
): ReturnType<T> {
3029
return fn();
3130
}
3231

packages/opentelemetry-context-base/src/types.ts

-11
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ export interface ContextManager {
3232
fn: T
3333
): ReturnType<T>;
3434

35-
/**
36-
* Run the async fn callback with an active scope
37-
*
38-
* @param scope Context to be active during function invocation
39-
* @param fn An async callback to be immediately run with an active context
40-
*/
41-
withAsync<T extends Promise<any>, U extends (...args: unknown[]) => T>(
42-
scope: Context,
43-
fn: U
44-
): Promise<T>;
45-
4635
/**
4736
* Bind an object as the current context (or a specific one)
4837
* @param target Any object to which a context need to be set

packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts

-4
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,4 @@ export class ZoneContextManager implements ContextManager {
248248

249249
return newZone.run(fn, context);
250250
}
251-
252-
withAsync(context: Context, fn: Function) {
253-
return fn();
254-
}
255251
}

packages/opentelemetry-web/src/StackContextManager.ts

-4
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,4 @@ export class StackContextManager implements ContextManager {
119119
this._currentContext = previousContext;
120120
}
121121
}
122-
123-
withAsync(context: Context, fn: Function) {
124-
return fn();
125-
}
126122
}

0 commit comments

Comments
 (0)