> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Side Effect Import

A side-effect import is an import declaration that executes a module's code for its global side effects without binding any of its exported members to the current module's scope.

```typescript theme={"dark"}
import "module-name";
import "./local-module.js";
```

## Mechanics and Behavior

**Scope and Binding**
Unlike standard import declarations, a side-effect import does not introduce any local variables, functions, or types into the importing module's namespace. The target module is evaluated, but its `export` statements are ignored by the importing file.

**Compiler Emit and Elision**
The TypeScript compiler (`tsc`) performs import elision: it removes import statements from the emitted JavaScript if it determines the imported members are only used in type positions. However, side-effect imports are strictly exempt from this process. The compiler guarantees that a side-effect import is never elided and will always be preserved in the compiled JavaScript output.

**Type System Integration**
During the compilation phase, TypeScript parses the target module of a side-effect import. If the target module contains ambient declarations or global type augmentations, the compiler applies them to the global type environment.

```typescript theme={"dark"}
// global-types.ts
declare global {
  interface Window {
    customProperty: string;
  }
}
export {};

// main.ts
import "./global-types.js"; // Side-effect import

// The compiler now recognizes 'customProperty' on the global Window interface
window.customProperty = "value"; 
```

**Evaluation Order**
In accordance with the ECMAScript Modules (ESM) specification, import declarations are hoisted. The JavaScript runtime resolves the module graph and evaluates the side-effect module *before* the importing module's own code begins executing. It is not evaluated inline at the lexical position of the `import` statement. Per the specification, the module is evaluated exactly once, regardless of how many times it is imported across the application.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor TypeScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
