Link Search Menu Expand Document
Table of contents

Check out the original file to see the original source.

Imports are hoisted to the top of the file.

import { readFile } from "fs";
readFile;
[Function: readFile]

Even in environments without top level await, it works.

const delay = () =>
  new Promise(
    /* executor: */ (rs) => setTimeout(/* callback: */ rs, /* ms: */ 1)
  );
await delay();

We can import stuff one at a time.

import { writeFile } from "fs";
writeFile;
[Function: writeFile]

If the same import statement is repeated, it is de-duplicated.

import { writeFile } from "fs";
writeFile;
[Function: writeFile]

This document used eval-md