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.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.
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 itsexport 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.
import statement. Per the specification, the module is evaluated exactly once, regardless of how many times it is imported across the application.
Master TypeScript with Deep Grasping Methodology!Learn More





