A
A
Andrey Rogov2017-01-03 09:29:46
typescript
Andrey Rogov, 2017-01-03 09:29:46

What does the as operator mean?

Urgently studying React in relation to the project, I met the as operator in the line "import {routerReducer as routing} from 'react-router-redux';"
Can anyone tell me what this operator does? Here is a listing of the src/routes/index.tsx file:

import {combineReducers} from "redux";
import {Location} from "history";
import {routerReducer as routing} from 'react-router-redux';

import routes, {RoutesState} from "routes/reducer";

import connections, {ConnectionStates} from './connections';
import session, {SessionState} from './session';
import authToken from "./authToken";


export interface RootState {
  routing: {
    locationBeforeTransitions: Location;
  };

  connections: ConnectionStates;
  session: SessionState;
  authToken: string;

  routes: RoutesState;
}

export function getRootReducer() {
  return combineReducers<RootState>({
    routing,

    connections,
    session,
    authToken,

    routes,
  });
}

In theory, the operator should allow the variable to be considered as belonging to the routing type, but routing was not imported from anywhere. And searching for the word "routing" throughout the project (including the node_modules folder) does not find anything suitable.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question