Javascript 网页包错误TS2339:类型“JQuery”上不存在属性“dialog”

Javascript 网页包错误TS2339:类型“JQuery”上不存在属性“dialog”,javascript,jquery,typescript,webpack,Javascript,Jquery,Typescript,Webpack,我的webpack.config.js是 var path = require('path'); module.exports = { entry: { 'AdminPanel/AdminPanel': '../../client/scripts/AdminPanel/AdminPanel.ts', 'Registration/Registration': '../../client/scripts/Registration/Registration.t

我的webpack.config.js是

var path = require('path');

module.exports = {
    entry: {
        'AdminPanel/AdminPanel': '../../client/scripts/AdminPanel/AdminPanel.ts',
        'Registration/Registration': '../../client/scripts/Registration/Registration.ts'
    },
    output: {
        filename: '[name].js',
        path: '../../src/client/scripts'
    },
    resolve: {
        extensions: ['.webpack.js', '.web.js', '.ts', '.js']
    },
    module: {
        loaders: [
            { test: /\.ts$/, loader: 'ts-loader' },
            { test: /\.css$/, loader: "style-loader!css-loader" },
            { test: /\.(woff|woff2|eot|ttf|svg)$/, loader: 'url-loader' },
            { test: /bootstrap\/dist\/js\/umd\//, loader: 'imports?jQuery=jquery' },
            { test: /\.(jpe?g|png|gif)$/i, loader: "file-loader" }
        ]
    }
}
package.json的内容

我的ts文件

import * as $ from 'jquery';
import 'jqueryui/jquery-ui.js';
import 'bootstrap/dist/css/bootstrap.css';
import 'jqueryui/jquery-ui.css';

$(document).ready(function () {
    alert('hi');
    let s = '<input class="date" type= "date" name= "txtFromUniversityDate" id= "txtFromUniversityDate" placeholder= "Please select joining date." > </p>';
    $('.container').dialog();
});
要生成编译版本,我运行以下命令:

tsc&&webpack-config.././webpack.config.js-显示错误详细信息-详细信息-监视

但我遇到了以下错误:

/client/scripts/AdminPanel/AdminPanel.ts中出错 9,21:错误TS2339:类型“JQuery”上不存在属性“dialog”


有人能帮我解决这个错误吗?

您需要为jQuery UI安装TypeScript定义。

我认为这是网页包中的错误,或者可能是一个功能。我在这里发布一个答案,以防将来有人需要它。在文件顶部添加对d.ts的引用(与模块引用相同)解决了该问题

/// <reference path="../../../node_modules/@types/jqueryui/index.d.ts" />
所有外部js文件也是如此

/// <reference path="../../../node_modules/@types/jqueryui/index.d.ts" />