A named import is a module resolution mechanism used to extract specific, explicitly exported bindings—such as variables, functions, classes, types, or interfaces—from an external module into the current module’s scope. Unlike default imports, named imports require exact identifier matching between the exporting module and the importing module, enabling static analysis and precise tree-shaking.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.
Basic Syntax
Named imports utilize destructuring-like syntax within curly braces{} to specify the exact identifiers to be imported.
Identifier Aliasing
To prevent namespace collisions within the local scope, named imports support immediate renaming using theas keyword. This binds the exported member to a new local identifier.
TypeScript-Specific Extensions: Type-Only Imports
TypeScript extends standard ECMAScript named imports with thetype modifier. This explicitly instructs the TypeScript compiler that the imported binding is used exclusively in the type system (e.g., as an interface or type alias). The compiler guarantees the erasure of these imports during the JavaScript emit phase, ensuring no runtime overhead or strict-mode module resolution errors.
Module-Level Type Import:
Applies the type-only constraint to all named imports within the statement.
type keyword.
Binding Mechanics
Named imports create a live, read-only view of the exported binding. The imported identifier cannot be reassigned within the importing module (e.g.,IdentifierA = newValue will throw a compiler error), but if the exporting module mutates the underlying value, the imported binding will reflect that updated state.
Master TypeScript with Deep Grasping Methodology!Learn More





