Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting elements with alias in Typescript/Javascript

I would like to rename the functions that I am exporting using the following syntax.

export const { selectIds, selectEntities, selectAll, selectTotal } = adapter.getSelectors(selectState);

So that I can import selectAll as selectAllThings into other files.

Is this possible with Typescript/Javascript?

like image 693
Jason Avatar asked Aug 28 '26 17:08

Jason


1 Answers

yes you can set alias on import stage:

import { selectAll as selectAllThings } from 'path_to_file';

or you can set alias on descructurization stage:

export const { selectAll: selectAllThings } = adapter.getSelectors(selectState);
like image 97
izmaylovdev Avatar answered Aug 31 '26 07:08

izmaylovdev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!