2017-03-20 91 views
1

導入類型,併爲其分配一個別名我有相同的名稱(reducer)兩大導出函數在兩個不同的文件是否有可能在打字稿

我可以導入它們是這樣的:

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

和訪問功能appReducer.reducer

如果我不希望與*進口的一切,我爲什麼不能做:

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

可能有其他方法嗎?

回答

2

它應該是:

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

docs about importing所示。