1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-09 07:39:15 -05:00

BREAKING CHANGE: change return type of Deno.resources() (#4893)

This commit is contained in:
Bartek Iwańczuk 2020-04-25 22:02:15 +02:00 committed by GitHub
parent b33685e94b
commit 62150dd328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2139,19 +2139,20 @@ declare namespace Deno {
*/
export function metrics(): Metrics;
/** **UNSTABLE**: reconsider representation. */
interface ResourceMap {
[rid: number]: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[rid: number]: any;
}
/** **UNSTABLE**: The return type is under consideration and may change.
/** Returns a map of open resource ids (rid) along with their string
* representations. This is an internal API and as such resource
* representation has `any` type; that means it can change any time.
*
* Returns a map of open _file like_ resource ids (rid) along with their string
* representations.
*
* console.log(Deno.resources()); // e.g. { 0: "stdin", 1: "stdout", 2: "stderr" }
* console.log(Deno.resources());
* // { 0: "stdin", 1: "stdout", 2: "stderr" }
* Deno.openSync('../test.file');
* console.log(Deno.resources()); // e.g. { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" }
* console.log(Deno.resources());
* // { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" }
*/
export function resources(): ResourceMap;