Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
532 changes: 1 addition & 531 deletions types/node/assert.d.ts

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions types/node/async_hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* can be accessed using:
*
* ```js
* const async_hooks = require('async_hooks');
* import async_hooks from 'async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/async_hooks.js)
*/
declare module 'async_hooks' {
/**
* ```js
* const async_hooks = require('async_hooks');
* import { executionAsyncId } from 'async_hooks';
*
* console.log(async_hooks.executionAsyncId()); // 1 - bootstrap
* console.log(executionAsyncId()); // 1 - bootstrap
* fs.open(path, 'r', (err, fd) => {
* console.log(async_hooks.executionAsyncId()); // 6 - open()
* console.log(executionAsyncId()); // 6 - open()
* });
* ```
*
Expand Down Expand Up @@ -51,11 +51,11 @@ declare module 'async_hooks' {
* but having an object representing the top-level can be helpful.
*
* ```js
* const { open } = require('fs');
* const { executionAsyncId, executionAsyncResource } = require('async_hooks');
* import { open } from 'fs';
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
*
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
* open(__filename, 'r', (err, fd) => {
* open(new URL(import.meta.url), 'r', (err, fd) => {
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
* });
* ```
Expand All @@ -64,12 +64,12 @@ declare module 'async_hooks' {
* use of a tracking `Map` to store the metadata:
*
* ```js
* const { createServer } = require('http');
* const {
* import { createServer } from 'http';
* import {
* executionAsyncId,
* executionAsyncResource,
* createHook
* } = require('async_hooks');
* } from 'async_hooks';
* const sym = Symbol('state'); // Private symbol to avoid pollution
*
* createHook({
Expand Down Expand Up @@ -167,9 +167,9 @@ declare module 'async_hooks' {
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
*
* ```js
* const async_hooks = require('async_hooks');
* import { createHook } from 'async_hooks';
*
* const asyncHook = async_hooks.createHook({
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
* destroy(asyncId) { }
* });
Expand Down Expand Up @@ -223,7 +223,7 @@ declare module 'async_hooks' {
* The following is an overview of the `AsyncResource` API.
*
* ```js
* const { AsyncResource, executionAsyncId } = require('async_hooks');
* import { AsyncResource, executionAsyncId } from 'async_hooks';
*
* // AsyncResource() is meant to be extended. Instantiating a
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
Expand Down Expand Up @@ -331,8 +331,8 @@ declare module 'async_hooks' {
* logged within each request.
*
* ```js
* const http = require('http');
* const { AsyncLocalStorage } = require('async_hooks');
* import http from 'http';
* import { AsyncLocalStorage } from 'async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
Expand Down
2 changes: 1 addition & 1 deletion types/node/base.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in

// Reference required types from the default lib:
/// <reference lib="es2018" />
/// <reference lib="es2020" />
/// <reference lib="esnext.asynciterable" />
/// <reference lib="esnext.intl" />
/// <reference lib="esnext.bigint" />
Expand Down
Loading