0
是否有模塊出口聯盟類型格式...例如:流動型聯盟類型模塊出口
// actionTypes.js
export const CREATE_ACCOUNT = 'CREATE_ACCOUNT'
export const UPDATE_ACCOUNT = 'UPDATE_ACCOUNT'
export const DELETE_ACCOUNT = 'DELETE_ACCOUNT'
// reducer.js
import * as actionTypes from './actionTypes.js'
type Action = actionTypes
export default function(state: Object, action: Action){ ... }
是否有你需要做的是在導入文件中的原因是什麼?我通常只是在定義動作類型的模塊中創建union類型:'export type ActionTypes ='blah'| 「foo'''。 – Adam
我已經有'actionTypes.js'文件中的字符串了,所以我想我可以重用FTW。 –