I'm really confused by the following statement in an index.ts:
import z from 'path/to/z';
export const { x: y } = z;
What does the second line actually export and how does the value of z correlate with it? Also, what purpose does this kind of export serve?
This is an export declaration with a const destructuring pattern. y is the variable being declared, which is initialised with the x property of z.
It could (and perhaps should) be written as the equivalent
export const y = z.x;