Read imports and qualified names
#Named imports use braces. node: identifies a Node built-in module. Imports make this file a module; export exposes a declaration to other modules.
Fragment
Complete Node module.
Reference
Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
TypeScript docs Modules reference ↗TSConfig reference ↗
Named imports use braces. node: identifies a Node built-in module. Imports make this file a module; export exposes a declaration to other modules.
Fragment
Complete Node module.
export exposes a module name; it is distinct from class member visibility. TypeScript private is a checker restriction; JavaScript # fields enforce private access at runtime. Type-only exports are erased.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
Relative module specifiers depend on the execution/build workflow. This example targets emitted JavaScript in Node ESM, so it names .js in the TypeScript import. Direct Node TypeScript execution instead requires the actual .ts path.
Fragment
Two file fragments; Node ESM package. Direct-source and emitted workflows use different extensions.
package.json describes a package and scripts/dependencies; tsconfig.json configures TypeScript. A lockfile records resolved dependencies for its package manager. Node type stripping does not use tsconfig to type-check the program.
Fragment
Comment-labeled configuration fragment, not TypeScript source. Strict null checking is enabled by strict.
Node built-ins such as node:fs need no npm install. npm install adds a dependency to a package; --save-dev records development tooling. Installing a package and importing a name from it are separate steps.
Fragment
Illustrative shell commands only; no package is installed by this reference. Type declarations may be separate.