JavaScript Modules Importing named members with aliases

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


Sometimes you may encounter members that have really long member names, such as thisIsWayTooLongOfAName(). In this case, you can import the member and give it a shorter name to use in your current module:

import {thisIsWayTooLongOfAName as shortName} from 'module'


You can import multiple long member names like this:

import {thisIsWayTooLongOfAName as shortName, thisIsAnotherLongNameThatShouldNotBeUsed as otherName} from 'module'


And finally, you can mix import aliases with the normal member import:

import {thisIsWayTooLongOfAName as shortName, PI} from 'module'


Got any JavaScript Question?