I have an application built by React hooks. So, In the case where using userReducer I have special actions file like this
export namespace PrepareReviewActions {
export enum Types {
TOGGLE_CONFIRMATION,
TOGGLE_ALL_CHECKED,
SET_EXCEPTION_TYPES,
SET_ACTION_TYPE
}
export class ToggleConfirmation implements Action {
public readonly type: Types.TOGGLE_CONFIRMATION;
public constructor(public opened?: boolean) {}
}
export class ToggleAllChecked implements Action {
public readonly type: Types.TOGGLE_ALL_CHECKED;
public constructor(public checked?: boolean) {}
}
export class SetExceptionTypes implements Action {
public readonly type: Types.SET_EXCEPTION_TYPES;
public constructor(public exceptionTypes?: Array<string>) {}
}
export class SetActionTypes implements Action {
public readonly type: Types.SET_ACTION_TYPE;
public constructor(public actionType?: string) {}
}
export type All = ToggleConfirmation | ToggleAllChecked | SetExceptionTypes | SetActionTypes;
}
My question regarding this line export type All = ToggleConfirmation | ToggleAllChecked | SetExceptionTypes | SetActionTypes;
Why | (vertical bar) is used for joining?
And what is different if I will use & (ampersand) ? Like this for example:
export type All = ToggleConfirmation & ToggleAllChecked & SetExceptionTypes & SetActionTypes;