Skip to main content

export / import Module System

export means "make this function available for external import."

// With export → can be imported externally
export const createUserRepo = () => { ... };
// import { createUserRepo } from "..." ✅

// Without export → only usable within this file
const helperFunction = () => { ... };
// import { helperFunction } from "..." ❌ not found

Python Equivalent

Python defaults to everything being public; JS/TS defaults to private — you need export to make something importable.

JavaScript/TypeScriptPython
Default visibilityPrivate (requires export)Public
Restricting external accessDon't add exportUse _ prefix (convention)