TS2769 Ошибка типа, строка не может быть назначена каналу <{payload: any;}> в sagas.ts после обновления - PullRequest
0 голосов
/ 23 сентября 2019

Я новичок в React и Saga, и меня смущает следующее сообщение об ошибке, которое появилось после того, как я обновил все пакеты.Вывод веб-пакета полон ошибок того же вида:

[./src/sagas.ts] 78.3 KiB {main} [built] [21 errors]
    + 1791 hidden modules
ERROR in C:\myProject\UI\src\sagas.ts
./src/sagas.ts
[tsl] ERROR inC:\myProject\src\sagas.ts(47,21)
      TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type '"LOAD_POSITION_IDS"' is not assignable to parameter of type 'TakeableChannel<unknown>'.

Соответствующие строки кода в sagas.ts read

function* watchLoadPositionIds({ type, payload }) {
    yield(takeEvery(Actions.LOAD_POSITION_IDS, loadPositionIds));
};

export default function* rootSaga() {
    yield fork(General.saga);
    yield fork(watchLoadPositionIds);
}

Resources

Справочная информация

Это может быть проблема с веб-пакетом, так что вот мой webpack.config.json:

var path = require('path');
module.exports = {
    entry: ["babel-polyfill", "whatwg-fetch","./src/index.tsx"],
    resolve: {
        extensions: [".ts", ".tsx", ".js", ".json"]
    },
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: [
                    { loader: "babel-loader" },
                    { loader: "ts-loader" }
                ]
            },  
            { test: /\.css$/, loader: 'css-loader' },
            { test: /\.js$/, loader: 'babel-loader' },
            {
                test: /\.less$/,
                use: [
                    { loader: 'style-loader'}, // 
                    { loader: 'css-loader', }, // translates CSS into CommonJS
                    {
                        loader: 'less-loader',
                        options: {
                            javascriptEnabled: true
                        }
                    }, // compiles Less to CSS
                   ]
            }
        ]
    },
    devtool: "inline-source-map",
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    }
};

Мой package.json читает

{
  "version": "1.3.3.7",
  "name": "myUI",
  "private": true,
  "scripts": {
    "npm audit": "npm audit",
    "webpack": "webpack --config webpack.config.js --mode=development --watch",
  },
  "dependencies": {
    "antd": "^3.23.3",
    "babel-plugin-import": "^1.12.2",
    "download": "^7.1.0",
    "immutable": "^3.8.2",
    "moment": "^2.24.0",
    "react": "16.9.0",
    "react-dom": "16.9.0",
    "react-redux": "^7.1.1",
    "react-router-dom": "^5.0.1",
    "react-router-redux": "^5.0.0-alpha.8",
    "redux": "^4.0.4",
    "redux-effects": "^0.4.3",
    "redux-saga": "^1.1.1",
    "reselect": "^4.0.0",
    "whatwg-fetch": "^3.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/polyfill": "^7.6.0",
    "@babel/preset-env": "^7.6.0",
    "@babel/preset-react": "^7.0.0",
    "@babel/register": "^7.6.0",
    "@types/react": "^16.9.2",
    "@types/react-dom": "16.9.0",
    "@types/react-redux": "^7.1.2",
    "@types/react-router-dom": "^4.3.5",
    "@types/react-router-redux": "^5.0.18",
    "ajv": "^6.10.2",
    "awesome-typescript-loader": "5.2.1",
    "babel-core": "^6.26.3",
    "babel-env": "^2.4.1",
    "babel-loader": "^7.1.5",
    "css-loader": "^3.2.0",
    "less": "^3.10.3",
    "less-loader": "^5.0.0",
    "mini-css-extract-plugin": "^0.8.0",
    "prop-types": "^15.7.2",
    "source-map-loader": "0.2.4",
    "style-loader": "^1.0.0",
    "ts-loader": "^6.1.1",
    "typescript": "^3.6.3",
    "webpack": "^4.40.2",
    "webpack-cli": "^3.3.9"
  }
}
...