refactor: add typescript definition
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
import { ChannelMessage } from '../../types/channel';
|
||||
import { EntityId } from '../../types/common';
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { EntityId } from "../../types/common";
|
||||
import { ChatEvent } from "../../types/sse";
|
||||
|
||||
export interface State {
|
||||
[gid: number]: number[] | undefined;
|
||||
@@ -18,7 +18,7 @@ const channelMsgSlice = createSlice({
|
||||
fullfillChannelMsg(state, action: PayloadAction<State>) {
|
||||
return action.payload;
|
||||
},
|
||||
addChannelMsg(state, action) {
|
||||
addChannelMsg(state, action: PayloadAction<ChatEvent>) {
|
||||
const { id, mid, local_id = null } = action.payload;
|
||||
if (state[id]) {
|
||||
const midExsited = state[id]!.findIndex((id) => id == mid) > -1;
|
||||
|
||||
Reference in New Issue
Block a user