类型'“ click”'的参数不能分配给类型'TypeEventHandlers <Document,(this:...)

时间:2020-04-06 06:07:09

标签: typescript

$(document).on('click', '#focal-toggle', function(this: HTMLElement | HTMLElement[], e:MouseEvent) {
No overload matches this call.
  The last overload gave the following error.
    Argument of type '"click"' is not assignable to parameter of type 'TypeEventHandlers<Document, (this: HTMLElement | HTMLElement[], e: MouseEvent) => void, Document, Document>'.
{
    "resource": "/root/dev/work/OutrunInteractive2020/webfocusview/plain/ts/webfocusview.ts",
    "owner": "typescript",
    "code": "2769",
    "severity": 8,
    "message": "No overload matches this call.\n  The last overload gave the following error.\n    Argument of type '\"click\"' is not assignable to parameter of type 'TypeEventHandlers<Document, (this: HTMLElement | HTMLElement[], e: MouseEvent) => void, Document, Document>'.",
    "source": "ts",
    "startLineNumber": 58,
    "startColumn": 18,
    "endLineNumber": 58,
    "endColumn": 25,
    "relatedInformation": [
        {
            "startLineNumber": 7957,
            "startColumn": 5,
            "endLineNumber": 7961,
            "endColumn": 13,
            "message": "The last overload is declared here.",
            "resource": "/root/dev/work/OutrunInteractive2020/webfocusview/plain/node_modules/@types/jquery/JQuery.d.ts"
        }
    ]
}

我似乎无法将on处理程序与打字稿一起使用。如何解决?

0 个答案:

没有答案