TS4023: Exported Variable has or is using name from external module but cannot be named

后端 未结 3 825
有刺的猬
有刺的猬 2021-02-04 03:18

I\'ve seen this answered before, but they don\'t seem to cover this specific use case (or they don\'t work/help)

import {Route} from \'vue-router\';


export con         


        
3条回答
  •  盖世英雄少女心
    2021-02-04 03:55

    I came across this when typing a rootReducer, in case anyone else is doing the same. I was importing typed reducers that were composed of other types (state, actions) that I had not also exported.

    Short answer: export all your action and state types from the reducers!

    Composite types seem not to work to well when their parts are not also exported and you rely on type inference. In this case, inferring the type of the rootReducer (which would be too much to explicitly type if you have more than just a few reducers).

    const rootReducer = combineReducers({ typedReducerA, typedReducerB, ... }
    

提交回复
热议问题