@@ -89,6 +89,10 @@ async function testDirectSockets() {
8989 // --------------------------------------------------------------------------------
9090 // TCPServerSocket
9191 // --------------------------------------------------------------------------------
92+
93+ // @ts -expect-error
94+ const invalidTcpServerOpenInfo : TCPServerSocketOpenInfo = { } ;
95+
9296 const tcpServerOptions : TCPServerSocketOptions = {
9397 localPort : 0 ,
9498 backlog : 5 ,
@@ -113,23 +117,45 @@ async function testDirectSockets() {
113117 // Open Info Structures
114118 // --------------------------------------------------------------------------------
115119
116- const udpOpenInfo : UDPSocketOpenInfo = { } ;
120+ const udpOpenInfo : UDPSocketOpenInfo = {
121+ readable : { } as ReadableStream ,
122+ writable : { } as WritableStream , // Only include if your d.ts actually requires this
123+ remoteAddress : "127.0.0.1" ,
124+ remotePort : 53 ,
125+ localAddress : "0.0.0.0" ,
126+ localPort : 4500 ,
127+ } ;
117128 // $ExpectType MulticastController | undefined
118129 udpOpenInfo . multicastController ;
119- // $ExpectType ReadableStream<any> | undefined
130+
131+ // $ExpectType ReadableStream<any>
120132 udpOpenInfo . readable ;
121133
122- const tcpOpenInfo : TCPSocketOpenInfo = { } ;
134+ // ============================================================================
135+ // TCPSocketOpenInfo (REQUIRED FIELDS TEST)
136+ // ============================================================================
137+
123138 // @ts -expect-error
124- tcpOpenInfo . multicastController ;
125- // $ExpectType WritableStream<any> | undefined
126- tcpOpenInfo . writable ;
139+ const invalidTcpOpenInfo : TCPSocketOpenInfo = { } ;
140+
141+ const validTcpOpenInfo : TCPSocketOpenInfo = {
142+ readable : { } as ReadableStream ,
143+ writable : { } as WritableStream ,
144+ remoteAddress : "127.0.0.1" ,
145+ remotePort : 80 ,
146+ localAddress : "192.168.1.5" ,
147+ localPort : 3000 ,
148+ } ;
149+
150+ // $ExpectType ReadableStream<any>
151+ validTcpOpenInfo . readable ;
152+ // $ExpectType WritableStream<any>
153+ validTcpOpenInfo . writable ;
154+ // $ExpectType string | undefined
155+ validTcpOpenInfo . remoteAddress ;
127156
128- const tcpServerOpenInfo : TCPServerSocketOpenInfo = { } ;
129- // $ExpectType ReadableStream<any> | undefined
130- tcpServerOpenInfo . readable ;
131157 // @ts -expect-error
132- tcpServerOpenInfo . writable ;
158+ validTcpOpenInfo . multicastController ;
133159
134160 // --------------------------------------------------------------------------------
135161 // MulticastController
0 commit comments