Skip to content

Commit b78e643

Browse files
committed
Miscellaneous fixes
1 parent 80502a7 commit b78e643

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/scala/io/scalajs/nodejs/stream/Readable.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.scalajs.nodejs.buffer.Buffer
66
import io.scalajs.nodejs.events.IEventEmitter
77

88
import scala.scalajs.js
9-
import scala.scalajs.js.|
109

1110
/**
1211
* The Readable stream interface is the abstraction for a source of data that you are reading from.
@@ -210,36 +209,36 @@ object Readable {
210209
* The event indicates that no more events will be emitted, and no further computation will occur.
211210
*/
212211
@inline
213-
def onClose[A](listener: () => A): readable.type = readable.on("close", listener)
212+
def onClose(listener: () => Any): readable.type = readable.on("close", listener)
214213

215214
/**
216215
* Attaching a 'data' event listener to a stream that has not been explicitly paused will switch the stream into
217216
* flowing mode. Data will then be passed as soon as it is available.
218217
*/
219218
@inline
220-
def onData[A](listener: Buffer | String | js.Any => A): readable.type = readable.on("data", listener)
219+
def onData[A](listener: A => Any): readable.type = readable.on("data", listener)
221220

222221
/**
223222
* This event fires when there will be no more data to read. Note that the 'end' event will not fire unless the
224223
* data is completely consumed. This can be done by switching into flowing mode, or by calling stream.read()
225224
* repeatedly until you get to the end.
226225
*/
227226
@inline
228-
def onEnd[A](listener: () => A): readable.type = readable.on("end", listener)
227+
def onEnd(listener: () => Any): readable.type = readable.on("end", listener)
229228

230229
/**
231230
* Emitted if there was an error when writing or piping data.
232231
*/
233232
@inline
234-
def onError[A](listener: Error => A): readable.type = readable.on("error", listener)
233+
def onError(listener: Error => Any): readable.type = readable.on("error", listener)
235234

236235
/**
237236
* When a chunk of data can be read from the stream, it will emit a 'readable' event. In some cases, listening
238237
* for a 'readable' event will cause some data to be read into the internal buffer from the underlying system,
239238
* if it hadn't already.
240239
*/
241240
@inline
242-
def onReadable[A](listener: () => A): readable.type = readable.on("readable", listener)
241+
def onReadable(listener: () => Any): readable.type = readable.on("readable", listener)
243242

244243
}
245244

0 commit comments

Comments
 (0)