Fix node 0.8 definitions

This commit is contained in:
Boris Yankov
2013-08-07 20:05:33 +03:00
parent db3d7fb795
commit 9c636325ef
2 changed files with 134 additions and 162 deletions
-28
View File
@@ -1,28 +0,0 @@
/// <reference path="node-0.8.8.d.ts" />
import assert = module("assert");
import fs = module("fs");
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
assert.equal(3, "3", "uses == comparator");
assert.notStrictEqual(2, "2", "uses === comparator");
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
assert.doesNotThrow(() => {
if (false) { throw "a hammer at your face"; }
}, undefined, "What the...*crunch*");
fs.writeFile("thebible.txt",
"Do unto others as you would have them do unto you.",
assert.ifError);
fs.writeFile("Harry Potter",
"\"You be wizzing, Harry,\" jived Dumbledore.",
"ascii",
assert.ifError);
+134 -134
View File
@@ -32,7 +32,7 @@ declare var module: {
require(id: string): any;
id: string;
filename: string;
loaded: bool;
loaded: boolean;
parent: any;
children: any[];
}
@@ -44,7 +44,7 @@ declare var SlowBuffer: {
new (size: number): NodeBuffer;
new (array: any[]): NodeBuffer;
prototype: NodeBuffer;
isBuffer(obj: any): bool;
isBuffer(obj: any): boolean;
byteLength(string: string, encoding?: string): number;
concat(list: NodeBuffer[], totalLength?: number): NodeBuffer;
};
@@ -53,7 +53,7 @@ declare var Buffer: {
new (size: number): NodeBuffer;
new (array: any[]): NodeBuffer;
prototype: NodeBuffer;
isBuffer(obj: any): bool;
isBuffer(obj: any): boolean;
byteLength(string: string, encoding?: string): number;
concat(list: NodeBuffer[], totalLength?: number): NodeBuffer;
}
@@ -76,9 +76,9 @@ interface EventEmitter {
}
interface WritableStream extends EventEmitter {
writable: bool;
write(str: string, encoding?: string, fd?: string): bool;
write(buffer: NodeBuffer): bool;
writable: boolean;
write(str: string, encoding?: string, fd?: string): boolean;
write(buffer: NodeBuffer): boolean;
end(): void;
end(str: string, enconding: string): void;
end(buffer: NodeBuffer): void;
@@ -87,12 +87,12 @@ interface WritableStream extends EventEmitter {
}
interface ReadableStream extends EventEmitter {
readable: bool;
readable: boolean;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
destroy(): void;
pipe(destination: WritableStream, options?: { end?: bool; }): void;
pipe(destination: WritableStream, options?: { end?: boolean; }): void;
}
interface NodeProcess extends EventEmitter {
@@ -123,18 +123,18 @@ interface NodeProcess extends EventEmitter {
variables: {
clang: number;
host_arch: string;
node_install_npm: bool;
node_install_waf: bool;
node_install_npm: boolean;
node_install_waf: boolean;
node_prefix: string;
node_shared_openssl: bool;
node_shared_v8: bool;
node_shared_zlib: bool;
node_use_dtrace: bool;
node_use_etw: bool;
node_use_openssl: bool;
node_shared_openssl: boolean;
node_shared_v8: boolean;
node_shared_zlib: boolean;
node_use_dtrace: boolean;
node_use_etw: boolean;
node_use_openssl: boolean;
target_arch: string;
v8_no_strict_aliasing: number;
v8_use_snapshot: bool;
v8_use_snapshot: boolean;
visibility: string;
};
};
@@ -158,34 +158,34 @@ interface NodeBuffer {
length: number;
copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): void;
slice(start?: number, end?: number): NodeBuffer;
readUInt8(offset: number, noAsset?: bool): number;
readUInt16LE(offset: number, noAssert?: bool): number;
readUInt16BE(offset: number, noAssert?: bool): number;
readUInt32LE(offset: number, noAssert?: bool): number;
readUInt32BE(offset: number, noAssert?: bool): number;
readInt8(offset: number, noAssert?: bool): number;
readInt16LE(offset: number, noAssert?: bool): number;
readInt16BE(offset: number, noAssert?: bool): number;
readInt32LE(offset: number, noAssert?: bool): number;
readInt32BE(offset: number, noAssert?: bool): number;
readFloatLE(offset: number, noAssert?: bool): number;
readFloatBE(offset: number, noAssert?: bool): number;
readDoubleLE(offset: number, noAssert?: bool): number;
readDoubleBE(offset: number, noAssert?: bool): number;
writeUInt8(value: number, offset: number, noAssert?: bool): void;
writeUInt16LE(value: number, offset: number, noAssert?: bool): void;
writeUInt16BE(value: number, offset: number, noAssert?: bool): void;
writeUInt32LE(value: number, offset: number, noAssert?: bool): void;
writeUInt32BE(value: number, offset: number, noAssert?: bool): void;
writeInt8(value: number, offset: number, noAssert?: bool): void;
writeInt16LE(value: number, offset: number, noAssert?: bool): void;
writeInt16BE(value: number, offset: number, noAssert?: bool): void;
writeInt32LE(value: number, offset: number, noAssert?: bool): void;
writeInt32BE(value: number, offset: number, noAssert?: bool): void;
writeFloatLE(value: number, offset: number, noAssert?: bool): void;
writeFloatBE(value: number, offset: number, noAssert?: bool): void;
writeDoubleLE(value: number, offset: number, noAssert?: bool): void;
writeDoubleBE(value: number, offset: number, noAssert?: bool): void;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
readUInt32BE(offset: number, noAssert?: boolean): number;
readInt8(offset: number, noAssert?: boolean): number;
readInt16LE(offset: number, noAssert?: boolean): number;
readInt16BE(offset: number, noAssert?: boolean): number;
readInt32LE(offset: number, noAssert?: boolean): number;
readInt32BE(offset: number, noAssert?: boolean): number;
readFloatLE(offset: number, noAssert?: boolean): number;
readFloatBE(offset: number, noAssert?: boolean): number;
readDoubleLE(offset: number, noAssert?: boolean): number;
readDoubleBE(offset: number, noAssert?: boolean): number;
writeUInt8(value: number, offset: number, noAssert?: boolean): void;
writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
writeInt8(value: number, offset: number, noAssert?: boolean): void;
writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
fill(value: any, offset?: number, end?: number): void;
INSPECT_MAX_BYTES: number;
}
@@ -218,9 +218,9 @@ declare module "events" {
}
declare module "http" {
import events = module("events");
import net = module("net");
import stream = module("stream");
import events = require("events");
import net = require("net");
import stream = require("stream");
export interface Server extends events.NodeEventEmitter {
listen(port: number, hostname?: string, backlog?: number, callback?: Function): void;
@@ -242,15 +242,15 @@ declare module "http" {
}
export interface ServerResponse extends events.NodeEventEmitter, stream.WritableStream {
// Extended base methods
write(str: string, encoding?: string, fd?: string): bool;
write(buffer: NodeBuffer): bool;
write(str: string, encoding?: string, fd?: string): boolean;
write(buffer: NodeBuffer): boolean;
writeContinue(): void;
writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void;
writeHead(statusCode: number, headers?: any): void;
statusCode: number;
setHeader(name: string, value: string): void;
sendDate: bool;
sendDate: boolean;
getHeader(name: string): string;
removeHeader(name: string): void;
write(chunk: any, encoding?: string): any;
@@ -259,15 +259,15 @@ declare module "http" {
}
export interface ClientRequest extends events.NodeEventEmitter, stream.WritableStream {
// Extended base methods
write(str: string, encoding?: string, fd?: string): bool;
write(buffer: NodeBuffer): bool;
write(str: string, encoding?: string, fd?: string): boolean;
write(buffer: NodeBuffer): boolean;
write(chunk: any, encoding?: string): void;
end(data?: any, encoding?: string): void;
abort(): void;
setTimeout(timeout: number, callback?: Function): void;
setNoDelay(noDelay?: Function): void;
setSocketKeepAlive(enable?: bool, initialDelay?: number): void;
setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
}
export interface ClientResponse extends events.NodeEventEmitter, stream.ReadableStream {
statusCode: number;
@@ -289,17 +289,17 @@ declare module "http" {
}
declare module "cluster" {
import child_process = module("child_process");
import child_process = require("child_process");
export interface ClusterSettings {
exec: string;
args: string[];
silent: bool;
silent: boolean;
}
export interface Worker {
id: string;
process: child_process.ChildProcess;
suicide: bool;
suicide: boolean;
send(message: any, sendHandle?: any): void;
destroy(): void;
disconnect(): void;
@@ -307,8 +307,8 @@ declare module "cluster" {
export var settings: ClusterSettings;
export var isMaster: bool;
export var isWorker: bool;
export var isMaster: boolean;
export var isWorker: boolean;
export function setupMaster(settings?: ClusterSettings): void;
export function fork(env?: any): Worker;
export function disconnect(callback?: Function): void;
@@ -326,7 +326,7 @@ declare module "cluster" {
}
declare module "zlib" {
import stream = module("stream");
import stream = require("stream");
export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; }
export interface Gzip extends stream.ReadWriteStream { }
@@ -404,9 +404,9 @@ declare module "os" {
}
declare module "https" {
import tls = module("tls");
import events = module("events");
import http = module("http");
import tls = require("tls");
import events = require("events");
import http = require("http");
export interface ServerOptions {
pfx?: any;
@@ -416,9 +416,9 @@ declare module "https" {
ca?: any;
crl?: any;
ciphers?: string;
honorCipherOrder?: bool;
requestCert?: bool;
rejectUnauthorized?: bool;
honorCipherOrder?: boolean;
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any;
SNICallback?: (servername: string) => any;
}
@@ -438,7 +438,7 @@ declare module "https" {
cert?: any;
ca?: any;
ciphers?: string;
rejectUnauthorized?: bool;
rejectUnauthorized?: boolean;
}
export interface NodeAgent {
@@ -470,30 +470,30 @@ declare module "punycode" {
}
declare module "repl" {
import stream = module("stream");
import events = module("events");
import stream = require("stream");
import events = require("events");
export interface ReplOptions {
prompt?: string;
input?: stream.ReadableStream;
output?: stream.WritableStream;
terminal?: bool;
terminal?: boolean;
eval?: Function;
useColors?: bool;
useGlobal?: bool;
ignoreUndefined?: bool;
useColors?: boolean;
useGlobal?: boolean;
ignoreUndefined?: boolean;
writer?: Function;
}
export function start(options: ReplOptions): events.NodeEventEmitter;
}
declare module "readline" {
import events = module("events");
import stream = module("stream");
import events = require("events");
import stream = require("stream");
export interface ReadLine extends events.NodeEventEmitter {
setPrompt(prompt: string, length: number): void;
prompt(preserveCursor?: bool): void;
prompt(preserveCursor?: boolean): void;
question(query: string, callback: Function): void;
pause(): void;
resume(): void;
@@ -504,7 +504,7 @@ declare module "readline" {
input: stream.ReadableStream;
output: stream.WritableStream;
completer?: Function;
terminal?: bool;
terminal?: boolean;
}
export function createInterface(options: ReadLineOptions): ReadLine;
}
@@ -523,8 +523,8 @@ declare module "vm" {
}
declare module "child_process" {
import events = module("events");
import stream = module("stream");
import events = require("events");
import stream = require("stream");
export interface ChildProcess extends events.NodeEventEmitter {
stdin: stream.WritableStream;
@@ -541,7 +541,7 @@ declare module "child_process" {
stdio?: any;
custom?: any;
env?: any;
detached?: bool;
detached?: boolean;
}): ChildProcess;
export function exec(command: string, options: {
cwd?: string;
@@ -582,7 +582,7 @@ declare module "url" {
pathname: string;
search: string;
query: string;
slashes: bool;
slashes: boolean;
}
export function parse(urlStr: string, parseQueryString? , slashesDenoteHost? ): Url;
@@ -606,12 +606,12 @@ declare module "dns" {
}
declare module "net" {
import stream = module("stream");
import stream = require("stream");
export interface NodeSocket extends stream.ReadWriteStream {
// Extended base methods
write(str: string, encoding?: string, fd?: string): bool;
write(buffer: NodeBuffer): bool;
write(str: string, encoding?: string, fd?: string): boolean;
write(buffer: NodeBuffer): boolean;
connect(port: number, host?: string, connectionListener?: Function): void;
connect(path: string, connectionListener?: Function): void;
@@ -623,8 +623,8 @@ declare module "net" {
pause(): void;
resume(): void;
setTimeout(timeout: number, callback?: Function): void;
setNoDelay(noDelay?: bool): void;
setKeepAlive(enable?: bool, initialDelay?: number): void;
setNoDelay(noDelay?: boolean): void;
setKeepAlive(enable?: boolean, initialDelay?: number): void;
address(): { port: number; family: string; address: string; };
remoteAddress: string;
remotePort: number;
@@ -633,7 +633,7 @@ declare module "net" {
}
export var Socket: {
new (options?: { fd?: string; type?: string; allowHalfOpen?: bool; }): NodeSocket;
new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): NodeSocket;
};
export interface Server extends NodeSocket {
@@ -646,20 +646,20 @@ declare module "net" {
connections: number;
}
export function createServer(connectionListener?: (socket: NodeSocket) =>void ): Server;
export function createServer(options?: { allowHalfOpen?: bool; }, connectionListener?: (socket: NodeSocket) =>void ): Server;
export function connect(options: { allowHalfOpen?: bool; }, connectionListener?: Function): void;
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: NodeSocket) =>void ): Server;
export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): void;
export function connect(port: number, host?: string, connectionListener?: Function): void;
export function connect(path: string, connectionListener?: Function): void;
export function createConnection(options: { allowHalfOpen?: bool; }, connectionListener?: Function): void;
export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): void;
export function createConnection(port: number, host?: string, connectionListener?: Function): void;
export function createConnection(path: string, connectionListener?: Function): void;
export function isIP(input: string): number;
export function isIPv4(input: string): bool;
export function isIPv6(input: string): bool;
export function isIPv4(input: string): boolean;
export function isIPv6(input: string): boolean;
}
declare module "dgram" {
import events = module("events");
import events = require("events");
export function createSocket(type: string, callback?: Function): Socket;
@@ -668,25 +668,25 @@ declare module "dgram" {
bind(port: number, address?: string): void;
close(): void;
address: { address: string; family: string; port: number; };
setBroadcast(flag: bool): void;
setBroadcast(flag: boolean): void;
setMulticastTTL(ttl: number): void;
setMulticastLoopback(flag: bool): void;
setMulticastLoopback(flag: boolean): void;
addMembership(multicastAddress: string, multicastInterface?: string): void;
dropMembership(multicastAddress: string, multicastInterface?: string): void;
}
}
declare module "fs" {
import stream = module("stream");
import stream = require("stream");
interface Stats {
isFile(): bool;
isDirectory(): bool;
isBlockDevice(): bool;
isCharacterDevice(): bool;
isSymbolicLink(): bool;
isFIFO(): bool;
isSocket(): bool;
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
dev: number;
ino: number;
mode: number;
@@ -771,11 +771,11 @@ declare module "fs" {
export function appendFile(filename: string, data: any, encoding?: string, callback?: Function): void;
export function appendFileSync(filename: string, data: any, encoding?: string): void;
export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void;
export function watchFile(filename: string, options: { persistent?: bool; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
export function unwatchFile(filename: string, listener?: Stats): void;
export function watch(filename: string, options?: { persistent?: bool; }, listener?: (event: string, filename: string) =>any): FSWatcher;
export function exists(path: string, callback?: (exists: bool) =>void ): void;
export function existsSync(path: string): bool;
export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) =>any): FSWatcher;
export function exists(path: string, callback?: (exists: boolean) =>void ): void;
export function existsSync(path: string): boolean;
export function createReadStream(path: string, options?: {
flags?: string;
encoding?: string;
@@ -816,9 +816,9 @@ declare module "string_decoder" {
}
declare module "tls" {
import crypto = module("crypto");
import net = module("net");
import stream = module("stream");
import crypto = require("crypto");
import net = require("net");
import stream = require("stream");
var CLIENT_RENEG_LIMIT: number;
var CLIENT_RENEG_WINDOW: number;
@@ -832,8 +832,8 @@ declare module "tls" {
crl?: any; //string or string array
ciphers?: string;
honorCipherOrder?: any;
requestCert?: bool;
rejectUnauthorized?: bool;
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any; //array or Buffer;
SNICallback?: (servername: string) => any;
}
@@ -847,7 +847,7 @@ declare module "tls" {
passphrase?: string;
cert?: any; //string | Buffer
ca?: any; //Array of string | Buffer
rejectUnauthorized?: bool;
rejectUnauthorized?: boolean;
NPNProtocols?: any; //Array of string | Buffer
servername?: string;
}
@@ -871,7 +871,7 @@ declare module "tls" {
}
export interface ClearTextStream extends stream.ReadWriteStream {
authorized: bool;
authorized: boolean;
authorizationError: Error;
getPeerCertificate(): any;
getCipher: {
@@ -896,7 +896,7 @@ declare module "tls" {
export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
export function createSecurePair(credentials?: crypto.Credentials, isServer?: bool, requestCert?: bool, rejectUnauthorized?: bool): SecurePair;
export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
}
declare module "crypto" {
@@ -926,14 +926,14 @@ declare module "crypto" {
interface Cipher {
update(data: any, input_encoding?: string, output_encoding?: string): string;
final(output_encoding?: string): string;
setAutoPadding(auto_padding: bool): void;
setAutoPadding(auto_padding: boolean): void;
createDecipher(algorithm: string, password: any): Decipher;
createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
}
interface Decipher {
update(data: any, input_encoding?: string, output_encoding?: string): void;
final(output_encoding?: string): string;
setAutoPadding(auto_padding: bool): void;
setAutoPadding(auto_padding: boolean): void;
}
export function createSign(algorithm: string): Signer;
interface Signer {
@@ -943,7 +943,7 @@ declare module "crypto" {
export function createVerify(algorith: string): Verify;
interface Verify {
update(data: any): void;
verify(object: string, signature: string, signature_format?: string): bool;
verify(object: string, signature: string, signature_format?: string): boolean;
}
export function createDiffieHellman(prime_length: number): DiffieHellman;
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
@@ -963,12 +963,12 @@ declare module "crypto" {
}
declare module "stream" {
import events = module("events");
import events = require("events");
export interface WritableStream extends events.NodeEventEmitter {
writable: bool;
write(str: string, encoding?: string, fd?: string): bool;
write(buffer: NodeBuffer): bool;
writable: boolean;
write(str: string, encoding?: string, fd?: string): boolean;
write(buffer: NodeBuffer): boolean;
end(): void;
end(str: string, enconding: string): void;
end(buffer: NodeBuffer): void;
@@ -977,12 +977,12 @@ declare module "stream" {
}
export interface ReadableStream extends events.NodeEventEmitter {
readable: bool;
readable: boolean;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
destroy(): void;
pipe(destination: WritableStream, options?: { end?: bool; }): void;
pipe(destination: WritableStream, options?: { end?: boolean; }): void;
}
export interface ReadWriteStream extends ReadableStream, WritableStream { }
@@ -995,11 +995,11 @@ declare module "util" {
export function puts(...param: any[]): void;
export function print(...param: any[]): void;
export function log(string: string): void;
export function inspect(object: any, showHidden?: bool, depth?: number, color?: bool): void;
export function isArray(object: any): bool;
export function isRegExp(object: any): bool;
export function isDate(object: any): bool;
export function isError(object: any): bool;
export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): void;
export function isArray(object: any): boolean;
export function isRegExp(object: any): boolean;
export function isDate(object: any): boolean;
export function isError(object: any): boolean;
export function inherits(constructor: any, superConstructor: any): void;
}
@@ -1022,12 +1022,12 @@ declare module "assert" {
}
declare module "tty" {
import net = module("net");
import net = require("net");
export function isatty(fd: string): bool;
export function isatty(fd: string): boolean;
export interface ReadStream extends net.NodeSocket {
isRaw: bool;
setRawMode(mode: bool): void;
isRaw: boolean;
setRawMode(mode: boolean): void;
}
export interface WriteStream extends net.NodeSocket {
columns: number;
@@ -1036,7 +1036,7 @@ declare module "tty" {
}
declare module "domain" {
import events = module("events");
import events = require("events");
export interface Domain extends events.NodeEventEmitter { }