mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Node 9.3 (#22593)
* SignalsListener signal name https://github.com/nodejs/node/pull/15606 * created Node 8 folder * Create tsconfig.json * Create tslint.json * Create node-tests.ts * Node 9 * update node header * Tabs to spaces * copy inspector.d.ts to v8 folder * correct path mapping for v8 * disable no-declare-current-package for v8 module * Correct version to 9.3.x Add writableHighWaterMark/readableHighWaterMark to WriteStream/ReadStream fixed setUncaughtExceptionCaptureCallback() Add module.builtinModules change os.EOL to const add writableHighWaterMark to Duplex writableHighWaterMark and readableHighWaterMark are readonly * fs.realpathSync.native and fs.realpath.native * fs.realpath.native tests
This commit is contained in:
35
types/node/index.d.ts
vendored
35
types/node/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Node.js 8.5.x
|
||||
// Type definitions for Node.js 9.3.x
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
|
||||
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
|
||||
@@ -20,12 +20,6 @@
|
||||
// Klaus Meinhardt <https://github.com/ajafff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
* Node.js v8.5.x API *
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
/** inspector module types */
|
||||
/// <reference path="./inspector.d.ts" />
|
||||
|
||||
@@ -34,6 +28,7 @@ interface Console {
|
||||
Console: NodeJS.ConsoleConstructor;
|
||||
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
||||
dir(obj: any, options?: NodeJS.InspectOptions): void;
|
||||
debug(message?: any, ...optionalParams: any[]): void;
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
@@ -457,7 +452,6 @@ declare namespace NodeJS {
|
||||
remove(emitter: Events): void;
|
||||
bind(cb: (err: Error, data: any) => any): any;
|
||||
intercept(cb: (data: any) => any): any;
|
||||
dispose(): void;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
@@ -512,7 +506,7 @@ declare namespace NodeJS {
|
||||
type UnhandledRejectionListener = (reason: any, promise: Promise<any>) => void;
|
||||
type WarningListener = (warning: Error) => void;
|
||||
type MessageListener = (message: any, sendHandle: any) => void;
|
||||
type SignalsListener = () => void;
|
||||
type SignalsListener = (signal: Signals) => void;
|
||||
type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
||||
|
||||
@@ -525,6 +519,7 @@ declare namespace NodeJS {
|
||||
}
|
||||
|
||||
export interface WriteStream extends Socket {
|
||||
readonly writableHighWaterMark: number;
|
||||
columns?: number;
|
||||
rows?: number;
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
@@ -536,6 +531,7 @@ declare namespace NodeJS {
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
export interface ReadStream extends Socket {
|
||||
readonly readableHighWaterMark: number;
|
||||
isRaw?: boolean;
|
||||
setRawMode?(mode: boolean): void;
|
||||
_read(size: number): void;
|
||||
@@ -570,6 +566,8 @@ declare namespace NodeJS {
|
||||
setegid(id: number | string): void;
|
||||
getgroups(): number[];
|
||||
setgroups(groups: Array<string | number>): void;
|
||||
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
||||
hasUncaughtExceptionCaptureCallback(): boolean;
|
||||
version: string;
|
||||
versions: ProcessVersions;
|
||||
config: {
|
||||
@@ -600,6 +598,7 @@ declare namespace NodeJS {
|
||||
};
|
||||
kill(pid: number, signal?: string | number): void;
|
||||
pid: number;
|
||||
ppid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
platform: Platform;
|
||||
@@ -790,6 +789,7 @@ declare namespace NodeJS {
|
||||
class Module {
|
||||
static runMain(): void;
|
||||
static wrap(code: string): string;
|
||||
static builtinModules: string[];
|
||||
|
||||
static Module: typeof Module;
|
||||
|
||||
@@ -1725,7 +1725,7 @@ declare module "os" {
|
||||
export function arch(): string;
|
||||
export function platform(): NodeJS.Platform;
|
||||
export function tmpdir(): string;
|
||||
export var EOL: string;
|
||||
export const EOL: string;
|
||||
export function endianness(): "BE" | "LE";
|
||||
}
|
||||
|
||||
@@ -3514,6 +3514,11 @@ declare module "fs" {
|
||||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
||||
*/
|
||||
export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
||||
|
||||
export function native(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void;
|
||||
export function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void;
|
||||
export function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void;
|
||||
export function native(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3537,6 +3542,12 @@ declare module "fs" {
|
||||
*/
|
||||
export function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
||||
|
||||
export namespace realpathSync {
|
||||
export function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
||||
export function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
|
||||
export function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
||||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||
@@ -5293,6 +5304,7 @@ declare module "stream" {
|
||||
|
||||
export class Readable extends Stream implements NodeJS.ReadableStream {
|
||||
readable: boolean;
|
||||
readableHighWaterMark: number;
|
||||
constructor(opts?: ReadableOptions);
|
||||
_read(size: number): void;
|
||||
read(size?: number): any;
|
||||
@@ -5379,6 +5391,7 @@ declare module "stream" {
|
||||
|
||||
export class Writable extends Stream implements NodeJS.WritableStream {
|
||||
writable: boolean;
|
||||
readonly writableHighWaterMark: number;
|
||||
constructor(opts?: WritableOptions);
|
||||
_write(chunk: any, encoding: string, callback: (err?: Error) => void): void;
|
||||
_writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void;
|
||||
@@ -5470,6 +5483,7 @@ declare module "stream" {
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
export class Duplex extends Readable implements Writable {
|
||||
writable: boolean;
|
||||
readonly writableHighWaterMark: number;
|
||||
constructor(opts?: DuplexOptions);
|
||||
_write(chunk: any, encoding: string, callback: (err?: Error) => void): void;
|
||||
_writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void;
|
||||
@@ -5649,7 +5663,6 @@ declare module "domain" {
|
||||
remove(emitter: events.EventEmitter): void;
|
||||
bind(cb: (err: Error, data: any) => any): any;
|
||||
intercept(cb: (data: any) => any): any;
|
||||
dispose(): void;
|
||||
members: any[];
|
||||
enter(): void;
|
||||
exit(): void;
|
||||
|
||||
@@ -339,6 +339,32 @@ namespace fs_tests {
|
||||
b = fs.realpathSync('/path/to/folder', { encoding: 'buffer' });
|
||||
const v2 = fs.realpathSync('/path/to/folder', { encoding: s });
|
||||
typeof v2 === "string" ? s = v2 : b = v2;
|
||||
|
||||
// native
|
||||
fs.realpath.native('/path/to/folder', (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', undefined, (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', 'utf8', (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', 'buffer', (err, resolvedPath) => b = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', s, (err, resolvedPath) => typeof resolvedPath === 'string' ? s = resolvedPath : b = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', {}, (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', { encoding: undefined }, (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', { encoding: 'utf8' }, (err, resolvedPath) => s = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', { encoding: 'buffer' }, (err, resolvedPath) => b = resolvedPath);
|
||||
fs.realpath.native('/path/to/folder', { encoding: s }, (err, resolvedPath) => typeof resolvedPath === "string" ? s = resolvedPath : b = resolvedPath);
|
||||
|
||||
s = fs.realpathSync.native('/path/to/folder');
|
||||
s = fs.realpathSync.native('/path/to/folder', undefined);
|
||||
s = fs.realpathSync.native('/path/to/folder', 'utf8');
|
||||
b = fs.realpathSync.native('/path/to/folder', 'buffer');
|
||||
const v3 = fs.realpathSync.native('/path/to/folder', s);
|
||||
typeof v3 === "string" ? s = v3 : b = v3;
|
||||
|
||||
s = fs.realpathSync.native('/path/to/folder', {});
|
||||
s = fs.realpathSync.native('/path/to/folder', { encoding: undefined });
|
||||
s = fs.realpathSync.native('/path/to/folder', { encoding: 'utf8' });
|
||||
b = fs.realpathSync.native('/path/to/folder', { encoding: 'buffer' });
|
||||
const v4 = fs.realpathSync.native('/path/to/folder', { encoding: s });
|
||||
typeof v4 === "string" ? s = v4 : b = v4;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2608,6 +2634,13 @@ namespace process_tests {
|
||||
const oldHandler = listeners[listeners.length - 1];
|
||||
process.addListener('uncaughtException', oldHandler);
|
||||
}
|
||||
{
|
||||
function myCb(err: Error): void {
|
||||
}
|
||||
process.setUncaughtExceptionCaptureCallback(myCb);
|
||||
process.setUncaughtExceptionCaptureCallback(null);
|
||||
const b: boolean = process.hasUncaughtExceptionCaptureCallback();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -3913,6 +3946,7 @@ namespace module_tests {
|
||||
|
||||
const m1: Module = new Module("moduleId");
|
||||
const m2: Module = new Module.Module("moduleId");
|
||||
const b: string[] = Module.builtinModules;
|
||||
let paths: string[] = module.paths;
|
||||
paths = m1.paths;
|
||||
}
|
||||
|
||||
7160
types/node/v8/index.d.ts
vendored
Normal file
7160
types/node/v8/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2488
types/node/v8/inspector.d.ts
vendored
Normal file
2488
types/node/v8/inspector.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3873
types/node/v8/node-tests.ts
Normal file
3873
types/node/v8/node-tests.ts
Normal file
File diff suppressed because it is too large
Load Diff
29
types/node/v8/tsconfig.json
Normal file
29
types/node/v8/tsconfig.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"node": [
|
||||
"node/v8"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
26
types/node/v8/tslint.json
Normal file
26
types/node/v8/tslint.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"dt-header": false,
|
||||
"max-line-length": false,
|
||||
"no-any-union": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-namespace": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-var-keyword": false,
|
||||
"prefer-const": false,
|
||||
"prefer-method-signature": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user