Skip to content

redux-toolkit.esm has no exported member PayloadAction #600

@telaviv

Description

@telaviv

Let me start by saying, I'm sure this is a configuration issue, but I can't find any information about this and I'm not even sure where to start debugging.

I have some code like this:

import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { Card } from 'engine'

export default createSlice({
    name: 'selectedCard',
    initialState: null as Card | null,
    reducers: {
        setCard: (state, { card }: createAction.PayloadAction<Card>) =>
            card.payload,
        clearCard: () => null,
    },
})

And errors like this:

[tsl] ERROR in /home/shawn/dev/card-dungeon-redux/client/reducers/selectedCard.ts(1,23)
      TS2305: Module '"../../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm"' has no exported member 'PayloadAction'.

When I look at the redux-toolkit.esm I in fact see no exported member called PayloadAction. I don't see a types.d.ts with global types. I'm not sure how I'm supposed to get access to this guy.

Maybe a related issue, but I'm also getting issues with the type in state in the createSlice definition.

[tsl] ERROR in /home/shawn/dev/card-dungeon-redux/client/reducers/selectedCard.ts(8,19)
      TS7006: Parameter 'state' implicitly has an 'any' type.

Here is my tsconfig:

{
  "compilerOptions": {
    "outDir": "./dist/",
    "noImplicitAny": true,
    "module": "es6",
    "target": "es5",
    "jsx": "react",
    "sourceMap": true,
    "allowSyntheticDefaultImports": true,
    "allowJs": true
  },
  "include": [
    "client/**/*",
    "common/**/*"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions