0

Got this error:

Property 'authnUser' does not exist on type 'TypedUseSelectorHook<RootState>'.

I try export like this:

export const authnUser = (state: TypedUseSelectorHook<RootState>) =>
    state.authnUser

I have following declarations:

interface RootState {
    authnResp: AuthnRes
    soldTickets: SoldTicketRes
}

const initialState: RootState = {
    authnResp: null,
    soldTickets: null,
}

const tikexAPI = createSlice({
    name: 'authnUser',
    initialState,
    reducers: {
        setAuthnRes(state, action: PayloadAction<AuthnRes | null>) {
            state.authnResp = action.payload
        },
    },
János
  • 32,867
  • 38
  • 193
  • 353

1 Answers1

0

It should probably be

export const authnUser = (state: RootState) =>
    state.authnUser
phry
  • 35,762
  • 5
  • 67
  • 81