Modules: import and export
Files with import or export are modules. Use import type for types only.
Example
// in one file:
export const x = 1;
export type Id = number;
// in another: import { x } from "./a"; import type { Id } from "./a";
console.log("module syntax");Result
module syntax
Exercise
Export a value.
const x = 1;Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.