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'
shortName()
You can import multiple long member names like this:
import {thisIsWayTooLongOfAName as shortName, thisIsAnotherLongNameThatShouldNotBeUsed as otherName} from 'module'
shortName()
console.log(otherName)
And finally, you can mix import aliases with the normal member import:
import {thisIsWayTooLongOfAName as shortName, PI} from 'module'
shortName()
console.log(PI)