此代码返回错误:
case TOGGLE_BANK: {
const mode: modes =
state.mode === smoothPianoKit ? initialState.mode : smoothPianoKit;
return {
...state,
bank: !state.bank,
bankMode: mode,
mode: mode
};
}
我具有此接口属性,我想在其中结合其类型,即模式中的bankModeTypes:
export const heaterKit = 'Heater Kit';
export const smoothPianoKit = 'Smooth Piano Kit';
export const heater1 = 'Heater-1';
export type bankModeTypes = typeof heaterKit | typeof smoothPianoKit;
export type modes = bankModeTypes | typeof heater1
export interface DrumMachineState {
bankMode: bankModeTypes;
mode: modes | bankModeTypes;
}
如您所见,smoothPianoKit是bankModeTypes,在我包括它的模式上,或者为什么这不起作用?我不想用任何东西。