类型 'IncomingHttpHeaders' 不可分配给类型 'BusboyHeaders'

Type 'IncomingHttpHeaders' is not assignable to type 'BusboyHeaders'

我在 typescript/Node 项目中使用 busboy 进行文件上传,在 busboy 的每个文档中 他们用请求 headers 初始化它,但我收到此错误 Type 'IncomingHttpHeaders' is not assignable to type 'BusboyHeaders'. 这是我的代码

import { NextFunction, Request, Response, Router } from "express";
import Busboy = require('busboy');
import * as path from "path";
import * as fs from "fs";

export class FileUploader {

    // method for file upload to server.
    public upload(req: Request, res: Response, next?: NextFunction) {
        const busboy = Busboy({ headers: req.headers });
        

        busboy.on("file", function (fieldname, file, filename, encoding, mimetype) {

            // path to file upload
            const saveTo = path.join((path.join(__dirname, "/../images/" + filename)));

            file.pipe(fs.createWriteStream(saveTo));
        });

        busboy.on("finish", function () {
            res.status(200).json({ "message": "File uploaded successfully." });
        });
        req.pipe(busboy);

    }
}

在下一行出现错误

const busboy = Busboy({ headers: req.headers });

Busboy 只需要 content-type(小写)作为 header 字段。只需提供 busboy 的快速请求内容类型:

import * as Busboy from 'busboy';

    const busboy = new Busboy({
        headers: {
            'content-type': event.headers['content-type'] || event.headers['Content-Type'],
        }
    });