@@ -33,7 +33,10 @@ declare module "node:diagnostics_channel" {
3333 * @param name The channel name
3434 * @return The named channel object
3535 */
36- function channel ( name : string | symbol ) : Channel ;
36+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
37+ function channel < ContextType = any , StoreType = ContextType > (
38+ name : string | symbol ,
39+ ) : Channel < ContextType , StoreType > ;
3740 type ChannelListener = ( message : unknown , name : string | symbol ) => void ;
3841 /**
3942 * Register a message handler to subscribe to this channel. This message handler
@@ -96,12 +99,9 @@ declare module "node:diagnostics_channel" {
9699 * @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
97100 * @return Collection of channels to trace with
98101 */
99- function tracingChannel <
100- StoreType = unknown ,
101- ContextType extends object = StoreType extends object ? StoreType : object ,
102- > (
103- nameOrChannels : string | TracingChannelCollection < StoreType , ContextType > ,
104- ) : TracingChannel < StoreType , ContextType > ;
102+ function tracingChannel < ContextType extends object = object , StoreType = ContextType > (
103+ nameOrChannels : string | TracingChannelCollection < ContextType , StoreType > ,
104+ ) : TracingChannel < ContextType , StoreType > ;
105105 /**
106106 * The class `Channel` represents an individual named channel within the data
107107 * pipeline. It is used to track subscribers and to publish messages when there
@@ -111,7 +111,7 @@ declare module "node:diagnostics_channel" {
111111 * with `new Channel(name)` is not supported.
112112 * @since v15.1.0, v14.17.0
113113 */
114- class Channel < StoreType = unknown , ContextType = StoreType > {
114+ class Channel < ContextType = any , StoreType = ContextType > {
115115 readonly name : string | symbol ;
116116 /**
117117 * Check if there are active subscribers to this channel. This is helpful if
@@ -304,12 +304,12 @@ declare module "node:diagnostics_channel" {
304304 } ,
305305 ) => void ;
306306 }
307- interface TracingChannelCollection < StoreType = unknown , ContextType = StoreType > {
308- start : Channel < StoreType , ContextType > ;
309- end : Channel < StoreType , ContextType > ;
310- asyncStart : Channel < StoreType , ContextType > ;
311- asyncEnd : Channel < StoreType , ContextType > ;
312- error : Channel < StoreType , ContextType > ;
307+ interface TracingChannelCollection < ContextType extends object = object , StoreType = ContextType > {
308+ start : Channel < ContextType , StoreType > ;
309+ end : Channel < ContextType , StoreType > ;
310+ asyncStart : Channel < ContextType , StoreType > ;
311+ asyncEnd : Channel < ContextType , StoreType > ;
312+ error : Channel < ContextType , StoreType > ;
313313 }
314314 /**
315315 * The class `TracingChannel` is a collection of `TracingChannel Channels` which
@@ -320,12 +320,9 @@ declare module "node:diagnostics_channel" {
320320 * @since v19.9.0
321321 * @experimental
322322 */
323- class TracingChannel < StoreType = unknown , ContextType extends object = { } > implements TracingChannelCollection {
324- start : Channel < StoreType , ContextType > ;
325- end : Channel < StoreType , ContextType > ;
326- asyncStart : Channel < StoreType , ContextType > ;
327- asyncEnd : Channel < StoreType , ContextType > ;
328- error : Channel < StoreType , ContextType > ;
323+ interface TracingChannel < ContextType extends object = object , StoreType = ContextType >
324+ extends TracingChannelCollection < ContextType , StoreType >
325+ {
329326 /**
330327 * Helper to subscribe a collection of functions to the corresponding channels.
331328 * This is the same as calling `channel.subscribe(onMessage)` on each channel
0 commit comments