0

我正在使用 Visual Studio 2015 更新 3 和 typescript 2.0.6(下面的 package.json)。
将下面的行添加到我的 app.module.ts 文件时,我在编译时遇到多个错误 - 在 browser-support.service.d.ts 中出现“重复标识符'readonly'错误以及“找不到名称'scrollbarWidth'”。如果我编译后添加以下行,kendo ui控件在调试时将起作用。只有当cs文件更改或我进行重建时才会出现错误。是否需要为kendo ui angular2添加打字文件?

此行出错

import { GridModule } from '@progress/kendo-angular-grid';

包.json

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "dependencies": {
    "@angular/common": "~2.0.2",
    "@angular/compiler": "~2.0.2",
    "@angular/core": "~2.0.2",
    "@angular/forms": "~2.0.2",
    "@angular/http": "~2.0.2",
    "@angular/platform-browser": "~2.0.2",
    "@angular/platform-browser-dynamic": "~2.0.2",
    "@angular/router": "~3.0.2",
    "@angular/upgrade": "~2.0.2",
    "@progress/kendo-angular-buttons": "^0.13.2",
    "@progress/kendo-angular-dialog": "^0.12.1",
    "@progress/kendo-angular-dropdowns": "^0.16.5",
    "@progress/kendo-angular-grid": "^0.5.0",
    "@progress/kendo-angular-intl": "^0.6.2",
    "@progress/kendo-angular-popup": "^0.12.0",
    "@progress/kendo-charts": "^0.8.0",
    "@progress/kendo-drawing": "^0.10.0",
    "@progress/kendo-popup-common": "^0.1.1",
    "@telerik/kendo-draggable": "^1.4.1",
    "@telerik/kendo-dropdowns-common": "^0.1.1",
    "@telerik/kendo-inputs-common": "^2.0.0",
    "@telerik/kendo-intl": "^0.10.3",
    "@telerik/kendo-theme-default": "^1.28.3",
    "angular-in-memory-web-api": "~0.1.5",
    "bootstrap": "3.3.6",
    "core-js": "^2.4.1",
    "jquery": "2.2.0",
    "jquery-validation": "1.14.0",
    "jquery-validation-unobtrusive": "3.2.6",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25"
  },
  "devDependencies": {
    "concurrently": "^3.0.0",
    "lite-server": "^2.2.2",
    "typescript": "^2.0.6",
    "typings": "^1.5.0",
    "gulp": "3.8.11",
    "gulp-concat": "2.5.2",
    "gulp-cssmin": "0.1.7",
    "gulp-uglify": "1.2.0",
    "rimraf": "2.2.8"
  }
}

Systemjs.config.js

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
    System.config({
        paths: {
            // paths serve as alias
            'npm:': 'lib/'
        },
        // map tells the System loader where to look for things
        map: {
            // our app is within the app folder
            app: 'app',

            '@progress': 'lib/@progress',
            '@telerik': 'lib/@telerik',

            // angular bundles
            '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
            '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
            '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
            '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
            '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
            '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
            '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
            '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

            // other libraries
            'rxjs': 'npm:rxjs',
            'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {

            "@progress/kendo-angular-dropdowns": { "main": "./dist/npm/js/main.js", "defaultExtension": "js" },
            "@progress/kendo-angular-grid": { "main": "./dist/npm/js/main.js", "defaultExtension": "js" },
            "@progress/kendo-angular-buttons": { "main": "./dist/npm/js/main.js", "defaultExtension": "js" },
            "@progress/kendo-angular-dialog": { "main": "./dist/npm/js/main.js", "defaultExtension": "js" },

            '@telerik/kendo-inputs-common': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@telerik/kendo-draggable': {
                defaultExtension: 'js',
                main: "./dist/npm/js/Draggable.js"
            },
            '@telerik/kendo-dropdowns-common': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@telerik/kendo-intl': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@progress/kendo-angular-intl': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@progress/kendo-angular-popup': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@progress/kendo-charts': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@progress/kendo-drawing': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },
            '@progress/kendo-popup-common': {
                defaultExtension: 'js',
                main: "./dist/npm/js/main.js"
            },

            app: {
                main: './main.js',
                defaultExtension: 'js'
            },
            rxjs: {
                defaultExtension: 'js'
            },
            'angular-in-memory-web-api': {
                main: './index.js',
                defaultExtension: 'js'
            }
        }
    });
})(this);

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "wwwroot/lib"
  ],
  "compileOnSave": true
}

4

1 回答 1

-1

安装 Typescript 2.1.4 后,我解决了这个问题。

于 2016-12-20T20:46:09.847 回答