jenson-button-event
jenson-button-event

Reputation: 18941

Is it possible to import a type and assign it an alias in Typescript

I have two exported functions with the same name (reducer) in two different files

I can import them like this:

import { * } as appReducer from '../app.reducer';
import { * } as otherReducer from './other.reducer';

and access the function as appReducer.reducer

If I don't wish to import everything with *, why cant i do:

import { reducer } as appReducer from './app.reducer';

Possible some other way?

Upvotes: 1

Views: 60

Answers (1)

Nitzan Tomer
Nitzan Tomer

Reputation: 164139

It should be:

import { reducer as appReducer } from './app.reducer';

As shown in the docs about importing.

Upvotes: 2

Related Questions