We duplicated the EventEmitter and Stream interfaces in the "event" module, so I removed the redundant interface definitions.
I have updated the ReadableStream/WritableStream interfaces in accordance with the current documentation:
http://nodejs.org/api/stream.html
I added class definitions for Writable/Transform/Duplex/PassThrough in 'event'. These classes are described in the following Node documentation:
http://nodejs.org/api/stream.html#stream_api_for_stream_implementors
As a result of these changes, I needed to slightly alter other typings to refer to the new interface name. This was unavoidable; I had to rename the `EventEmitter` interface to `NodeEventEmitter` to avoid clashing with the `events.EventEmitter` class that implements `NodeEventEmitter`.
Documentation for WritableStream.write:
http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback
There's no 'fd' argument; that might have been a typo.
You can call `write` in the following ways:
* write(data: Buffer)
* write(data: Buffer, cb: Function)
* write(data: String)
* write(data: String, cb: Function)
* write(data: String, encoding: String)
* write(data: String, encoding: String, cb: Function)
The same goes to `end`, except `end` can be called with no arguments, too.
From http://nodejs.org/api/buffer.html#buffer_buffer_inspect_max_bytes:
"...this is a property on the buffer module returned by require('buffer'), not on the Buffer global, or a buffer instance."
The Node typings do not have a notion of a buffer module, and introducing one would be more work than might be useful. It contains a reference to `Buffer` and `SlowBuffer`, which are currently defined as variables in the typings. I believe I would need
to redefine these in the module definition.
If anyone has any ideas for how to efficiently restructure this, let me know.
Latest API has an options object as the second parameter
instead of separate parameters. The old API is still supported
so have added the new signature as an overload.
Updated node-tests.ts
setTimeout, setInterval, setImmediate are fixed to accept more
arguments.
setTimeout, setInterval, clearTimeout, clearInterval are changed to
return and accept objects of the new Timer interface, which exposes the
ref() and unref() methods.
fs.readFileSync is changed so that it returns a string if it is passed
an options parameter with an "encoding" property, and returns a
NodeBuffer otherwise.
fs.watchFile and fs.unwatchFile listener parameters are fixed. listener
is a callback with two parameters, not an object with two properties.
fs.watch is fixed so a listener parameter can be given without an
options parameter.
crypto.randomBytes is fixed so that it can be called synchronously,
returning a NodeBuffer.
crypto.pseudoRandomBytes is added.
Allow for method chaining in addListener/removeListener, on/once,
and removeAllListeners.
Fix return type for 'emit'.
This patch mirrors the changes made to the API docs in this commit:
41cbdc5e64
I realize this could be considered pedantic, but the typings do not even consistently use one or the other. Previously, certain functions assumed string, others assumed number. This way, you can use either.
The following missing methods were added:
* fs.readlinkSync
* fs.ftruncate
* fs.ftruncateSync
The following method signatures were fixed:
* path.resolve: Takes an array of arbitrary length. This does not necessarily need to be a string array; resolve skips any non-string elements.
* process.cwd: Returns a string, not void.