npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@externs/nodejs

v1.5.0

Published

The Closure Compiler Externs For Node.JS.

Downloads

1,419

Readme

@externs/nodejs

npm version

@externs/nodejs is The Google Closure Compiler Externs For Node.JS.

yarn add -E @externs/nodejs

Table Of Contents

Method

The method is to use tsickle on the types definition file for Node.JS (@types/node/index.d.ts). However, there are a few steps that were taken to prepare the externs:

  1. The definitions are split into individual files, making it easier to track warnings and maintain the manual changes that have to be made for each extern.

  2. When trying to generate from the single file, there's a conflict between declare var Buffer and interface Buffer, which TypeScript is fine with, but tsickle fails to process properly. To overcome this, the NodeBuffer interface is just moved into a separate file, the externs for it are generated, and then manually updated to include static methods from var Buffer. This can also be done by declaring Buffer as a class with static methods, but we did it manually.

    // original node.d.ts
    // Declaring both var and interface DOES NOT WORK WITH TSICKLE
    interface Buffer extends NodeBuffer { }
    declare var Buffer: { }
    // later on ...
    interface NodeBuffer extends Uint8Array { }
  3. There have been tests added to the Buffer interface to make sure there are no warnings when working with Buffer API. These tests is just an illustration of how externs can be tested, i.e., to make sure the GCC does not produce any warnings.

    const ab = new ArrayBuffer(16)
    const data = ['hello', 'world']
    const string = 'hello world'
       
    /** @type {!Buffer} */
    var b
    b = new Buffer(string)
    b = new Buffer(string, 'utf8')
    b = new Buffer(100)
    b = new Buffer(new Uint8Array(100))
    b = new Buffer(ab)
    b = new Buffer(data)
    b = new Buffer(b)
       
    b = Buffer.from(ab)
    b = Buffer.from(ab, 10)
    b = Buffer.from(ab, 10, 20)
       
    b = Buffer.from(data)
    b = Buffer.from(string)
    b = Buffer.from(b)
    b = Buffer.from(ab)
       
    b = Buffer.from(string, 'utf8')
       
    /** @type {boolean} */
    var ib = Buffer.isBuffer(string)
    ib = Buffer.isBuffer(b)
       
    /** @type {boolean} */
    var ie = Buffer.isEncoding('utf8')
    ie = Buffer.isEncoding('sirocco5')
       
    /** @type {number} */
    var bl = Buffer.byteLength(string)
    bl = Buffer.byteLength(b)
    bl = Buffer.byteLength(new DataView(ab))
    bl = Buffer.byteLength(ab)
    bl = Buffer.byteLength(string, 'utf8')
       
    b = Buffer.concat([b, b])
    b = Buffer.concat([b, b], 10)
       
    /** @type {number} */
    var n = Buffer.compare(b, b)
       
    b = Buffer.alloc(10)
    b = Buffer.alloc(10, string)
    b = Buffer.alloc(10, b)
    b = Buffer.alloc(10, 10)
    b = Buffer.alloc(10, string, 'utf8')
       
    b = Buffer.allocUnsafe(10)
       
    b = Buffer.allocUnsafeSlow(10)
       
    /** @type {number} */
    var ps = Buffer.poolSize
  4. Because of warnings and cases that tsickle can't handle, some externs need manual update by looking at the error messages and also manual inspection of generated code.

  5. The globals are only defined as the global object in global.d.ts: declare var global: NodeJS.Global;. These do not get propagated to the global scope. For now, we're not sure whether properties of the NodeJS.Global other than Buffer should be expanded into the global context, because Closure will probably handle them already since they're generic JS.

    export interface Global {
        Array: typeof Array;
        ArrayBuffer: typeof ArrayBuffer;
        Boolean: typeof Boolean;
        Buffer: typeof Buffer;
        DataView: typeof DataView;
        Date: typeof Date;
        Error: typeof Error;
        EvalError: typeof EvalError;
        Float32Array: typeof Float32Array;
        Float64Array: typeof Float64Array;
        Function: typeof Function;
        GLOBAL: Global;
        Infinity: typeof Infinity;
        Int16Array: typeof Int16Array;
        Int32Array: typeof Int32Array;
        Int8Array: typeof Int8Array;
        Intl: typeof Intl;
        JSON: typeof JSON;
        Map: MapConstructor;
        Math: typeof Math;
        NaN: typeof NaN;
        Number: typeof Number;
        Object: typeof Object;
        Promise: Function;
        RangeError: typeof RangeError;
        ReferenceError: typeof ReferenceError;
        RegExp: typeof RegExp;
        Set: SetConstructor;
        String: typeof String;
        Symbol: Function;
        SyntaxError: typeof SyntaxError;
        TypeError: typeof TypeError;
        URIError: typeof URIError;
        Uint16Array: typeof Uint16Array;
        Uint32Array: typeof Uint32Array;
        Uint8Array: typeof Uint8Array;
        Uint8ClampedArray: Function;
        WeakMap: WeakMapConstructor;
        WeakSet: WeakSetConstructor;
        // clearImmediate is part of global extern
        clearImmediate: (immediateId: any) => void;
        // clearInterval is skipped by tsickle
        clearInterval: (intervalId: NodeJS.Timer) => void;
        // clearTimeout is skipped by tsickle
        clearTimeout: (timeoutId: NodeJS.Timer) => void;
        // console is part of global extern
        console: typeof console;
        decodeURI: typeof decodeURI;
        decodeURIComponent: typeof decodeURIComponent;
        encodeURI: typeof encodeURI;
        encodeURIComponent: typeof encodeURIComponent;
        escape: (str: string) => string;
        eval: typeof eval;
        // global is part of global extern
        global: Global;
        isFinite: typeof isFinite;
        isNaN: typeof isNaN;
        parseFloat: typeof parseFloat;
        parseInt: typeof parseInt;
        // process is part of global extern
        process: Process;
        // root is NOT part of global extern: SHOULD IT BE?
        root: Global;
        // setImmediate is part of global extern
        setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any;
        // setInterval is skipped by tsickle
        setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
        // setTimeout is skipped by tsickle
        setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
        undefined: typeof undefined;
        unescape: (str: string) => string;
        gc: () => void;
        v8debug?: any;
    }

The issue with splitting the declarations into separate files is that it is harder to merge upstream updates into it, and a lot of manual work has to be done. Therefore, ideally there would have to be patch scripts that would allow to update generated types, however at the moment externs are updated by hand when there are warnings.

API

import getExternsDir, { dependencies } from '@externs/nodejs'

The externs for each of the modules are found in the published v8 directory. The global and nodejs externs always need to be present when compiling a Node.JS program (unless its in pure JS). Externs might depend on other externs, and the dependency tree is exported by this package:

/* alanode example/ */
import getExternsDir, { dependencies } from '../src'

console.log('Externs dir: %s', getExternsDir())
console.log('Dependencies:')
console.log(dependencies)
Externs dir: v8
Dependencies:
{ url: [ 'querystring' ],
  stream: [ 'events' ],
  net: [ 'stream', 'events', 'dns' ],
  fs: [ 'stream', 'events', 'url' ],
  tls: [ 'crypto', 'dns', 'net', 'stream' ],
  http: [ 'events', 'net', 'stream', 'url' ],
  https: [ 'tls', 'events', 'http', 'url' ],
  http2: [ 'events', 'fs', 'net', 'stream', 'tls', 'http', 'url' ],
  zlib: [ 'stream' ],
  child_process: [ 'events', 'stream', 'net' ],
  cluster: [ 'child_process', 'events', 'net' ],
  readline: [ 'events', 'stream' ],
  repl: [ 'stream', 'readline' ],
  dgram: [ 'events', 'dns' ],
  string_decoder: [ 'buffer' ],
  domain: [ 'events' ],
  tty: [ 'net' ] }

getExternsDir(): string

Runs require.resolve('@externs/nodejs/package.json') to find the location of this package, and adds the v8 at the end to point to the externs version 8 (currently only Node 8 is supported).

How To Use

These externs were generated for the use by Depack: the dependency bundler for the web and back-end Node.JS. Depack will perform regex-based static analysis on modules, and when they import an internal module (e.g., path), it will mark an extern as needed to be added. It will then add the require call to the output wrapper:

import { join } from 'path'

// will produce the wrapper
const path = require('path')

The important thing about how compiling Node.JS packages works in Depack, is the strategy when a pseudo built-in module is placed in node_modules. For example, for the path internal, the following code will be produced in node_modules/path/index.js:

export default path
export const {
  basename,
  delimiter,
  dirname,
  extname,
  format,
  isAbsolute,
  join,
  normalize,
  parse,
  posix,
  relative,
  resolve,
  sep,
  win32,
} = path

Because path was previously defined in the output wrapper and an extern was added, all its properties will be destructured and exported correctly.

Clashes

This might need some rethinking...

There are 3 modules that have the same name as some global variable: module and console and buffer. The crypto extern already exists in the GCC. Therefore, Depack will require them using an underscore:

// module !== require('module') so this is good
const _module = require('module')
// console === require('console') so we might change that later
const _console = require('console')
// buffer === require('buffer') so we might change that later
const _buffer = require('buffer')
const _crypto = require('crypto')

Warnings And Todos

There were warnings that were emitted during the generation of each extern. Those warnings needed to be fixed manually. There are also TODO statements generated by tsickle that could not perform some analysis. They also needed (and still need) to be fixed manually.

tsickle is not able to handle:

  • PropertySignature:
    export interface IncomingHttpHeaders { 'accept'?: string; }
  • IncludesNonWideningType:
    export type ServerOptions = tls.SecureContextOptions & tls.TlsOptions;
  • omitting interface deriving from class (not always):
    export interface ReadableStream extends EventEmitter { }
  • omitting heritage reference to a type/value (not sure wat):
    export interface ErrnoException extends Error { }

omitting interface deriving from class For some reason, the class will not always be able to extend another class. E.g., the @extends {event.EventEmitter} has to be added manually in many files that rely on it.

Export = internal

Events and Stream have a typed structure that exports an internal property:

declare module "events" {
  class internal extends NodeJS.EventEmitter { }

  namespace internal {
    export class EventEmitter extends internal {
      static listenerCount(emitter: EventEmitter, event: string | symbol): number;
      ...
    }
  }

  export = internal;
}

This will result in externs having the internal property:

/**
 * @param {(string|symbol)} type
 * @return {number}
 */
events.internal.EventEmitter.prototype.listenerCount = function(type) {};

This is obviously incorrect, so that .internal needs to be removed manually.

Global

// interface NodeBuffer extends Uint8Array {
types-v8/global.d.ts(188,1): warning TS0: omitting heritage reference to a type/value conflict: Uint8Array
  • [x] Add @ extends {Uint8Array} to Buffer.

  • [x] Update NodeRequire to be callable, add tests:

    /**
    * @record
    * @struct
    */
    function NodeRequireFunction() {}
    
    /* TODO: CallSignature:  */
    /**
    * @extends {NodeRequireFunction}
    * @record
    * @struct
    */
    function NodeRequire() {}
    /** @type {!RequireResolve} */
    NodeRequire.prototype.resolve;
    /**
    * @record
    * @struct
    */
    function RequireResolve() {}
    /**
     * @param {string} id
     * @returns {?}
     */
    function NodeRequireFunction(id) {}
    
    /* TODO: CallSignature:  */
    /**
    * @param {string} id
    * @returns {*}
    */
    function NodeRequire(id) {}
    /** @type {!RequireResolve} */
    NodeRequire.prototype.resolve;
    /**
    * @param {string} request
    * @param {{paths:!Array<string>}} options
    * @return {string}
    */
    function RequireResolve(request, options) {}
  • [x] The NodeModule.prototype.require should not reference NodeRequire instead of NodeRequireFunction because NodeRequire is just a function without additional properties such as .cache etc. However, NodeRequireFunction still needs to be changed to a function from @struct.

Node.JS

Node.JS is an interface that contains API referenced in other classes. Although there's no such thing as NodeJS extern, its properties are referenced in other externs. Because it is also referenced in the global.d.ts, it will always be added by Depack when compiling a Node.JS program.

types-v8/nodejs.d.ts(98,3): warning TS0: omitting heritage reference to a type/value conflict: Error
types-v8/nodejs.d.ts(123,3): warning TS0: omitting interface deriving from class: EventEmitter
types-v8/nodejs.d.ts(137,3): warning TS0: omitting interface deriving from class: EventEmitter
types-v8/nodejs.d.ts(149,3): warning TS0: omitting interface deriving from class: EventEmitter
types-v8/nodejs.d.ts(255,3): warning TS0: omitting interface deriving from class: EventEmitter
types-v8/nodejs.d.ts(270,7): warning TS0: should not emit a 'never' type
types-v8/nodejs.d.ts(446,7): warning TS0: anonymous type has no symbol
  • [x] Add @extends {Error} to ErrnoException
  • [x] Add @extends {NodeJS.EventEmitter} to ReadableStream
  • [x] Add @extends {NodeJS.EventEmitter} to WritableStream
  • [x] Add @extends {NodeJS.EventEmitter} to Events
  • [x] Add @extends {NodeJS.EventEmitter} to Process
  • [ ] Add Intl type to NodeJS.Global.prototype.Intl;
  • [x] Remove @struct from ProcessEnv to prevent warning
    test/code.js:7: WARNING - Cannot do '[]' access on a struct
    const output = process.env['OUTPUT']
  • [x] Add Error.prepareStackTrace to the Closure's Error extern.

Events

  • [x] Remove .internal.

Because events is both a namespace, and a function, it is exported in the following way:

/** @const */
var events = {};
/**
 * @extends {NodeJS.EventEmitter}
 * @constructor
 * @struct
 */
events = function() {};

This will lead to the compiler warning:

v8/events.js:15: WARNING - accessing name events in externs has no effect. Perhaps you forgot to add a var keyword?
events = function() {};
^^^^^^

v8/events.js:15: WARNING - constant events assigned a value more than once.
Original definition at v8/events.js:9
events = function() {};
^^^^^^^^^^^^^^^^^^^^^^

Therefore, we collapse the 2 declarations together into

/**
 * @extends {NodeJS.EventEmitter}
 * @constructor
 * @struct
 */
var events = function() {};

Stream

// export class Duplex extends Readable implements Writable {
types-v8/stream.d.ts(200,7): warning TS0: omitting @implements of a class: Writable
  • [x] Remove .internal.
  • [x] Because @constructor cannot inherit more than one class, the @extends {Writable} is not added, however because the methods have been defined in types as implementations of the Writable interfaces, they are added to the Duplex prototype itself.

Same as for events (see above), collapse the declaration into a single var definition.

/**
 * @extends {events.EventEmitter}
 * @constructor
 * @struct
 */
var stream = function() {};

Assert

// export function fail(message?: string): never;
types-v8/assert.d.ts(19,7): warning TS0: should not emit a 'never' type

// export function fail(actual: any, expected: any, message?: string, operator?: string, stackStartFn?: Function): never;
types-v8/assert.d.ts(20,7): warning TS0: should not emit a 'never' type
  • [x] Remove .internal and {} namespace declaration (see Events for description).
  • [x] Despite the warning, the AssertionError does extend Error.
    // export class AssertionError implements Error {
    types-v8/assert.d.ts(4,7): warning TS0: omitting heritage reference to a type/value conflict: Error

Missing Methods In Types

  • [ ] doesNotReject added in V8.13.0
  • [ ] rejects added in V8.13.0
  • [ ] strict added in V8.13.0

v8

There are some missing APIs that appeared in Node 8 that are not present in types.

Missing Methods In Types

  • [ ] serialize
  • [ ] deserialize
  • [ ] cachedDataVersionTag
  • [ ] Serializer
  • [ ] Deserializer
  • [ ] DefaultSerializer
  • [ ] DefaultDeserializer

Cluster

  • [x] Already present @ extends {events.EventEmitter} to Cluster.
    // export interface Cluster extends events.EventEmitter {
    types-v8/cluster.d.ts(98,3): warning TS0: omitting interface deriving from class: events.EventEmitter

Missing Methods In Types

  • [ ] SCHED_NONE
  • [ ] SCHED_RR
  • [ ] domain
  • [ ] schedulingPolicy

Crypto

The crypto externs already exists in GCC, therefore the extern's namespace is added as `crypto.

types-v8/crypto.d.ts(10,14): warning TS0: type/symbol conflict for Certificate, using {?} for now
  • [ ] Fix the Certificate conflict.

Missing Methods In Types

  • [ ] Cipheriv
  • [ ] Decipheriv
  • [ ] DiffieHellmanGroup
  • [ ] Sign
  • [ ] constants
  • [ ] createDiffieHellmanGroup
  • [ ] prng
  • [ ] rng
  • [ ] setEngine

Dns

types-v8/dns.d.ts(272,7): warning TS0: unhandled anonymous type with multiple call signatures

types-v8/dns.d.ts(273,7): warning TS0: unhandled anonymous type with multiple call signatures

types-v8/dns.d.ts(274,7): warning TS0: unhandled anonymous type with multiple call signatures

The Resolver class has resolve, resolve4, resolve6 methods which it references in its definition, however those methods have multiple call signatures.

export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
// + N more

export class Resolver {
  ...
  resolve: typeof resolve;
  resolve4: typeof resolve4;
  resolve6: typeof resolve6;

This means the externs cannot be generated.

/** @type {?} */
dns.Resolver.prototype.resolve;
/** @type {?} */
dns.Resolver.prototype.resolve4;
/** @type {?} */
dns.Resolver.prototype.resolve6;
  • [ ] Add a type for each of the methods.

Fs

//   export interface FSWatcher extends events.EventEmitter {
types-v8/fs.d.ts(46,3): warning TS0: omitting interface deriving from class: events.EventEmitter

Tls

// export interface ClearTextStream extends stream.Duplex {
types-v8/tls.d.ts(327,3): warning TS0: omitting interface deriving from class: stream.Duplex

Http

Update Property Signatures.

/* TODO: PropertySignature: http.'accept' */
  • [ ] Add property signatures.
  • [x] Add maxHeaderSize type.

Https

types-v8/https.d.ts(12,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/https.d.ts(25,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/https.d.ts(44,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/https.d.ts(45,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/https.d.ts(46,3): warning TS0: unhandled type flags: IncludesNonWideningType

Http2

// export interface Http2Stream extends stream.Duplex {
types-v8/http2.d.ts(61,3): warning TS0: omitting interface deriving from class: stream.Duplex

// export interface Http2Session extends events.EventEmitter {
types-v8/http2.d.ts(248,3): warning TS0: omitting interface deriving from class: events.EventEmitter

// export interface Http2Server extends net.Server {
types-v8/http2.d.ts(405,3): warning TS0: omitting interface deriving from class: net.Server

// export interface Http2SecureServer extends tls.Server {
types-v8/http2.d.ts(449,3): warning TS0: omitting interface deriving from class: tls.Server

Zlib

types-v8/zlib.d.ts(32,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(33,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(34,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(35,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(36,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(37,3): warning TS0: omitting interface deriving from class: stream.Transform

types-v8/zlib.d.ts(38,3): warning TS0: omitting interface deriving from class: stream.Transform

Child_Process

types-v8/child_process.d.ts(10,3): warning TS0: omitting interface deriving from class: events.EventEmitter

types-v8/child_process.d.ts(126,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(129,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(133,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(139,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(144,7): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(145,7): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(147,7): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(172,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(174,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(198,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(199,3): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(213,7): warning TS0: unhandled type flags: IncludesNonWideningType

types-v8/child_process.d.ts(214,7): warning TS0: unhandled type flags: IncludesNonWideningType

Util

// export var inspect: {
types-v8/util.d.ts(11,14): warning TS0: unhandled anonymous type

Here, the inspect is defined in curly brackets for all of its possible signatures. tsickle does not understand that.

export var inspect: {
  (object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
  (object: any, options: InspectOptions): string;
  colors: {
    [color: string]: [number, number] | undefined
  }
  styles: {
    [style: string]: string | undefined
  }
  defaultOptions: InspectOptions;
  custom: symbol;
};
// export interface CustomPromisify<TCustom extends Function> extends Function {
types-v8/util.d.ts(42,3): warning TS0: omitting heritage reference to a type/value conflict: Function

Punycode

//   export var ucs2: ucs2;
types-v8/punycode.d.ts(6,14): warning TS0: type/symbol conflict for ucs2, using {?} for now

Readline

// export interface ReadLine extends events.EventEmitter {
types-v8/readline.d.ts(17,3): warning TS0: omitting interface deriving from class: events.EventEmitter
  • [x] Rename interface argument to _interface, otherwise the following error is shown:
    @externs/nodejs/v8/readline.js:185: ERROR - Parse error. ')' expected
    readline.emitKeypressEvents = function(stream, interface) {};
                                                  ^

Repl

// export class Recoverable extends SyntaxError {
types-v8/repl.d.ts(65,3): warning TS0: omitting heritage reference to a type/value conflict: SyntaxError

util

node_modules/util/index.js:11: WARNING - Property getSystemErrorName never defined on util
  getSystemErrorName,
  ^^^^^^^^^^^^^^^^^^

-[x] Adding to util.getSystemErrorName to externs manually.

querystring

-[x] Add decode and encode aliases to parse and stringify.

net

-[x] Add the Stream alias to Socket (currently the type is incorrect, i.e., /** @type {net.Socket} */ net.Stream. This assigned the instance type rather than constructor type.

WIP

Currently, after some ignored properties and methods not defined in externs, there are still warnings that have not been handled.

node_modules/buffer/index.js:6: WARNING - [JSC_INEXISTENT_PROPERTY] Property constants never defined on buffer
  constants,
  ^^^^^^^^^

node_modules/buffer/index.js:7: WARNING - [JSC_INEXISTENT_PROPERTY] Property kMaxLength never defined on buffer
  kMaxLength,
  ^^^^^^^^^^

node_modules/buffer/index.js:8: WARNING - [JSC_INEXISTENT_PROPERTY] Property kStringMaxLength never defined on buffer
  kStringMaxLength,
  ^^^^^^^^^^^^^^^^

node_modules/console/index.js:6: WARNING - [JSC_INEXISTENT_PROPERTY] Property context never defined on Console
  context,
  ^^^^^^^

node_modules/constants/index.js:4: WARNING - [JSC_INEXISTENT_PROPERTY] Property COPYFILE_EXCL never defined on constants
  COPYFILE_EXCL,
  ^^^^^^^^^^^^^

node_modules/constants/index.js:27: WARNING - [JSC_INEXISTENT_PROPERTY] Property EDQUOT never defined on constants
  EDQUOT,
  ^^^^^^

node_modules/constants/index.js:44: WARNING - [JSC_INEXISTENT_PROPERTY] Property EMULTIHOP never defined on constants
  EMULTIHOP,
  ^^^^^^^^^

node_modules/constants/index.js:95: WARNING - [JSC_INEXISTENT_PROPERTY] Property ESTALE never defined on constants
  ESTALE,
  ^^^^^^

node_modules/constants/index.js:103: WARNING - [JSC_INEXISTENT_PROPERTY] Property OPENSSL_VERSION_NUMBER never defined on constants
  OPENSSL_VERSION_NUMBER,
  ^^^^^^^^^^^^^^^^^^^^^^

node_modules/constants/index.js:125: WARNING - [JSC_INEXISTENT_PROPERTY] Property RSA_PSS_SALTLEN_AUTO never defined on constants
  RSA_PSS_SALTLEN_AUTO,
  ^^^^^^^^^^^^^^^^^^^^

node_modules/constants/index.js:126: WARNING - [JSC_INEXISTENT_PROPERTY] Property RSA_PSS_SALTLEN_DIGEST never defined on constants
  RSA_PSS_SALTLEN_DIGEST,
  ^^^^^^^^^^^^^^^^^^^^^^

node_modules/constants/index.js:127: WARNING - [JSC_INEXISTENT_PROPERTY] Property RSA_PSS_SALTLEN_MAX_SIGN never defined on constants
  RSA_PSS_SALTLEN_MAX_SIGN,
  ^^^^^^^^^^^^^^^^^^^^^^^^

node_modules/constants/index.js:139: WARNING - [JSC_INEXISTENT_PROPERTY] Property SIGINFO never defined on constants
  SIGINFO,
  ^^^^^^^

node_modules/constants/index.js:216: WARNING - [JSC_INEXISTENT_PROPERTY] Property UV_FS_COPYFILE_EXCL never defined on constants
  UV_FS_COPYFILE_EXCL,
  ^^^^^^^^^^^^^^^^^^^

node_modules/domain/index.js:4: WARNING - [JSC_INEXISTENT_PROPERTY] Property active never defined on domain
  active,
  ^^^^^^

node_modules/domain/index.js:6: WARNING - [JSC_INEXISTENT_PROPERTY] Property createDomain never defined on domain
  createDomain,
  ^^^^^^^^^^^^

node_modules/http2/index.js:3: WARNING - [JSC_BAD_PRIVATE_PROPERTY_ACCESS] Access to private property Http2ServerRequest of {
  ClientHttp2Session: (typeof http2.ClientHttp2Session),
  ClientHttp2Stream: (typeof http2.ClientHttp2Stream),
  ClientSessionOptions: None,
  ClientSessionRequestOptions: (typeof http2.ClientSessionRequestOptions),
  Http2SecureServer: (typeof http2.Http2SecureServer),
  Http2Server: (typeof http2.Http2Server),
  Http2ServerRequest: (typeof http2.Http2ServerRequest),
  Http2ServerResponse: (typeof http2.Http2ServerResponse),
  Http2Session: (typeof http2.Http2Session),
  Http2Stream: (typeof http2.Http2Stream), ...
} not allowed here.
  Http2ServerRequest,
  ^^^^^^^^^^^^^^^^^^

node_modules/http2/index.js:4: WARNING - [JSC_BAD_PRIVATE_PROPERTY_ACCESS] Access to private property Http2ServerResponse of {
  ClientHttp2Session: (typeof http2.ClientHttp2Session),
  ClientHttp2Stream: (typeof http2.ClientHttp2Stream),
  ClientSessionOptions: None,
  ClientSessionRequestOptions: (typeof http2.ClientSessionRequestOptions),
  Http2SecureServer: (typeof http2.Http2SecureServer),
  Http2Server: (typeof http2.Http2Server),
  Http2ServerRequest: (typeof http2.Http2ServerRequest),
  Http2ServerResponse: (typeof http2.Http2ServerResponse),
  Http2Session: (typeof http2.Http2Session),
  Http2Stream: (typeof http2.Http2Stream), ...
} not allowed here.
  Http2ServerResponse,
  ^^^^^^^^^^^^^^^^^^^

node_modules/process/index.js:7: WARNING - [JSC_INEXISTENT_PROPERTY] Property assert never defined on NodeJS.Process
  assert,
  ^^^^^^

node_modules/process/index.js:8: WARNING - [JSC_INEXISTENT_PROPERTY] Property binding never defined on NodeJS.Process
  binding,
  ^^^^^^^

node_modules/process/index.js:14: WARNING - [JSC_INEXISTENT_PROPERTY] Property dlopen never defined on NodeJS.Process
  dlopen,
  ^^^^^^

node_modules/process/index.js:21: WARNING - [JSC_INEXISTENT_PROPERTY] Property features never defined on NodeJS.Process
  features,
  ^^^^^^^^

node_modules/process/index.js:28: WARNING - [JSC_INEXISTENT_PROPERTY] Property initgroups never defined on NodeJS.Process
  initgroups,
  ^^^^^^^^^^

node_modules/process/index.js:32: WARNING - [JSC_INEXISTENT_PROPERTY] Property moduleLoadList never defined on NodeJS.Process
  moduleLoadList,
  ^^^^^^^^^^^^^^

node_modules/process/index.js:37: WARNING - [JSC_INEXISTENT_PROPERTY] Property ppid never defined on NodeJS.Process
  ppid,
  ^^^^

node_modules/process/index.js:38: WARNING - [JSC_INEXISTENT_PROPERTY] Property reallyExit never defined on NodeJS.Process
  reallyExit,
  ^^^^^^^^^^

node_modules/repl/index.js:4: WARNING - [JSC_INEXISTENT_PROPERTY] Property REPL_MODE_MAGIC never defined on repl
  REPL_MODE_MAGIC,
  ^^^^^^^^^^^^^^^

node_modules/repl/index.js:5: WARNING - [JSC_INEXISTENT_PROPERTY] Property REPL_MODE_SLOPPY never defined on repl
  REPL_MODE_SLOPPY,
  ^^^^^^^^^^^^^^^^

node_modules/repl/index.js:6: WARNING - [JSC_INEXISTENT_PROPERTY] Property REPL_MODE_STRICT never defined on repl
  REPL_MODE_STRICT,
  ^^^^^^^^^^^^^^^^

node_modules/repl/index.js:9: WARNING - [JSC_INEXISTENT_PROPERTY] Property writer never defined on repl
  writer,
  ^^^^^^

node_modules/timers/index.js:3: WARNING - [JSC_INEXISTENT_PROPERTY] Property active never defined on timers
  active,
  ^^^^^^

node_modules/timers/index.js:7: WARNING - [JSC_INEXISTENT_PROPERTY] Property enroll never defined on timers
  enroll,
  ^^^^^^

node_modules/timers/index.js:11: WARNING - [JSC_INEXISTENT_PROPERTY] Property unenroll never defined on timers
  unenroll,
  ^^^^^^^^

node_modules/tls/index.js:5: WARNING - [JSC_INEXISTENT_PROPERTY] Property DEFAULT_CIPHERS never defined on tls
  DEFAULT_CIPHERS,
  ^^^^^^^^^^^^^^^

node_modules/tls/index.js:7: WARNING - [JSC_INEXISTENT_PROPERTY] Property SLAB_BUFFER_SIZE never defined on tls
  SLAB_BUFFER_SIZE,
  ^^^^^^^^^^^^^^^^

node_modules/tls/index.js:13: WARNING - [JSC_INEXISTENT_PROPERTY] Property convertALPNProtocols never defined on tls
  convertALPNProtocols,
  ^^^^^^^^^^^^^^^^^^^^

node_modules/tls/index.js:14: WARNING - [JSC_INEXISTENT_PROPERTY] Property convertNPNProtocols never defined on tls
  convertNPNProtocols,
  ^^^^^^^^^^^^^^^^^^^

node_modules/tls/index.js:19: WARNING - [JSC_INEXISTENT_PROPERTY] Property parseCertString never defined on tls
  parseCertString,
  ^^^^^^^^^^^^^^^

0 error(s), 38 warning(s), 97.5% typed

Copyright

The types copyright belongs to their authors.

Type definitions for Node.js 8.10 by:

Taken from https://github.com/DefinitelyTyped/DefinitelyTyped