Fix capitalization of Array and Object types

Array and Object were often written as array and object, causing
warnings such as:

./buffer.js:32: WARNING - Bad type annotation. Unknown type object
 * @type {object.<string,*>}
          ^

Fix the warnings by correcting the capitalization.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Fix typos in type annotations

The intent of these annotations seems clear, fix the typos.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Fix unqualified uses of the buffer.Buffer type

The type requires the buffer namespace in order to be resolved.  Add it
where missing.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Buffer doesn't extend Array

From source inspection and usage, it's clear that Buffer doesn't extend
Array (for example, Buffer has no pop method).  Remove this annotation
(which also fixes the type incompatibility of the slice method).

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Fix type of cluster

cluster is actually an instance of the private Cluster type, which
extends EventEmitter.  Therefore, annotate cluster as being of type
EventEmitter.

Note:  This code is now not runnable, since assigning to cluster would
require either reference to the events namespace (which isn't imported)
or leaving it null which would fail for subsequent property accesses.
But that's fine, since externs aren't run.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Make options argument of child_process.fork optional

According to the docs (and code) this argument is optional.  This also
fixes the warning about non-optional arguments following optional
arguments.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Fix type of module.require

Although it has the same type as the global require function, the global
require function isn't a type (constructor).  So update the type of
module.require to match it.  This fixes the following warning:

./core.js:76: WARNING - Bad type annotation. Unknown type require
 * @type {require}
          ^

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Major reworking of streams

Update the annotations to match their definitions in node 0.10.  Also,
stream (the namespace) is not a class, use stream.Stream instead as
appropriate.

This commit doesn't fix the multiple inheritance/mixin issue with Duplex
needing to extend from both Readable and Writable.  This may require
defining some interfaces which can be implemented.

This commit also doesn't touch ReadableStream and WritableStream.  I'm
not sure of the purpose of these classes and since they are heavily used
in other namespaces, I'll leave them alone for now.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Add Date type to time arguments in fs

All of the functions which take a time argument accept either numbers
(as seconds since the epoch) or a Date.  Add the Date type to arguments
where it was missing.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Remove number assignment to Date properties

The properties of Stat with Date type were being assigned numbers, which
caused compile warnings.  Remove the unnecessary assignment.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Replace ServerRequest/ClientResponse with IncomingMessage

Replace the http.ServerRequest and http.ClientResponse classes with the
IncomingMessage class, as is done in recent versions of node.  Add the
missing members to the prototype.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Update crypto module

Lots of refactoring to work around the fact that Closure Compiler
doesn't have proper support for mixins.  Ensure that @extends meets the
requirement that X instanceof Y if X @extends Y.  Add copies of the
annotations for all mixin methods and aliased functions.

Also add missing annotations for pbkdf2.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Remove unnecessary members from tls.Server

These members are all inherited from net.Server and don't need to be
redefined for tls.Server (and the listen definition was causing type
warnings).

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Remove Object.prototype.inspect

I'm not sure if this used to be added by node, but I can't find it
anywhere in the docs or code in recent versions.  It was also causing
the following warning (due to a conflict with util.inspect):

./util.js:77: WARNING - assignment to property inspect of Object.<string,*>
found   : function (*, boolean=, number=, boolean=): string
required: function (this:Object): ?
util.inspect = function(object, showHidden, depth, colors) {};
^

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Match stream.WritableStream.end to stream.Writable.end

Until we decide what to do with WritableStream, fix it to avoid
producing any warnings.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Remove @nosideeffects from buffer.Buffer.prototype.copy

The side-effect of this method is copying data into the target buffer
given as an argument.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Remove @nosideeffects from fs functions with callback

The side-effectfulness of these functions is determined based on whether
the callback function has side-effects.  Presumably it does (what's the
point of the callback otherwise?).  So remove the @nosideeffects
annotation.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Merge pull request #2 from kevinoid/fix-some-type-errors

Fix type errors