将图表列表插件添加到Angular 5

将图表列表插件添加到Angular 5,angular,typescript,chartist.js,Angular,Typescript,Chartist.js,我正在尝试在Angular 5中构建一个项目,其中包含ChartList@types和ChartList插件的js文件 文件在angular 4中编译良好,但在angular 5中编译或加载失败。 我不知道该做什么 编译失败并出现错误的场景错误TS5055:无法写入文件“/chartist/chartist plugin tooltip.js”,因为它将覆盖输入文件 在这种情况下,我直接导入组件中的文件,如下所示: import * as CLegend from "../../../

我正在尝试在Angular 5中构建一个项目,其中包含ChartList@types和ChartList插件的js文件

文件在angular 4中编译良好,但在angular 5中编译或加载失败。 我不知道该做什么

编译失败并出现错误的场景
错误TS5055:无法写入文件“/chartist/chartist plugin tooltip.js”,因为它将覆盖输入文件

在这种情况下,我直接导入组件中的文件,如下所示:

import * as CLegend from "../../../chartist/chartist.legend";
import * as CPoints from "../../../chartist/chartist.pointlabels";
import * as CFDoughnut from '../../../chartist/chartist.fill-donut';
import * as CTooltip from '../../../chartist/chartist-plugin-tooltip';
这在Angular 4中起作用

编译成功的场景:

我已经在
angular cli.json
中添加了上述文件,它们位于
scripts
键下,带有一个数组

  "scripts": [
    "../chartist/chartist.legend.js",
    "../chartist/chartist.pointlabels.js",
    "../chartist/chartist.fill-donut.js",
    "../chartist/chartist-plugin-tooltip.js"
  ]
我已经尝试过了,这允许编译成功,但我在JS中遇到了错误,
ChartList.plugins
未定义

我曾尝试在我的
打字中添加此项。d.ts

interface Chartist {
  plugins? : any
}
还有这个

declare module 'ChartistLegend';
declare module 'ChartistPoints';
declare module 'ChartistFDoughnut';
declare module 'ChartistTooltip';
我单独使用了这两种方法,但没有一起使用

ng-v
输出:

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
            |___/

Angular CLI: 1.6.3
Node: 6.11.0
OS: win32 x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.3
@angular/cli: 1.6.3
@angular/material-moment-adapter: 5.0.3
@angular/material: 5.0.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
问候

对不起,我的手都冻僵了


编辑1:添加了角度版本

这需要一些尝试和错误,因为我找不到解决插件未定义问题的任何资源。就我而言,添加

import * as Chartist from 'chartist';
import 'chartist-plugin-tooltips';

解决了问题。

这需要一些尝试和错误,因为我找不到解决插件未定义问题的任何资源。就我而言,添加

import * as Chartist from 'chartist';
import 'chartist-plugin-tooltips';

已解决此问题。

我将确保typescript是最新的,并使用-aot标志生成。我假设ChartList与angular 5兼容?忘了提一下,ChartList是通过
@types/ChartList
使用的,构建失败时使用
--prod
标志<代码>ng serve首先失败,然后在我更改任何文件时正常运行。顺便说一句,typescript是2.4.2。我会确保typescript是最新的,并使用-aot标志生成。我假设ChartList与angular 5兼容?忘了提一下,ChartList是通过
@types/ChartList
使用的,构建失败时使用
--prod
标志<代码>ng serve在我更改任何文件时首先失败,然后正常运行。顺便说一句,typescript为2.4.2。