【问题标题】:trying to compiling typescript with reference to ng2-bootstrap with gulp in visual studio尝试在 Visual Studio 中使用 gulp 参考 ng2-bootstrap 编译打字稿
【发布时间】:2017-01-27 15:00:06
【问题描述】:

这几天我一直在努力解决这个问题,我希望有人可以帮助我。

我正在一个 aspnet 核心项目中试用 Angular2。设置是我使用 gulpfile.js 来构建 .ts 文件并将所有内容传输到 wwwroot 文件夹。一切正常。打字稿编译,文件被传输,甚至设置一个“hello world”角度应用程序工作正常..

当我尝试添加对 ng2-bootstrap 的引用时,问题就开始了。当我添加这个编译打字稿时,会出现几个错误,例如:

node_modules/ng2-bootstrap/components/buttons/button-checkbox.directive.d.ts(14,22): error TS1005: '=' expected.

请在此处访问我正在处理的示例:https://github.com/skyplusplus/ng2bootstrap-hell

我该如何解决这个问题?

-编辑- 相关 gulpfile sn -p:

const tscConfig = require('./tsconfig.json'); var tsProject = typescript.createProject('tsconfig.json'); return tsProject .src(tscConfig.files) .pipe(sourcemaps.init()) .pipe(typescript(tsProject)) .pipe(sourcemaps.write('.')) .pipe(gulp.dest(targetPaths.app));

【问题讨论】:

    标签: angular typescript visual-studio-2015 asp.net-core ng2-bootstrap


    【解决方案1】:

    配置 gulp 以忽略 node_modules 文件夹。 d.ts 文件是类型定义文件,它转译为 js 文件,其中只有一个引用 js.map 进行调试的注释。

    【讨论】:

    • 我不知道该怎么做。我尝试了几件事,例如在 tsconfig 文件的排除部分添加“node_modules”文件夹,并在该文件中设置文件部分。我正在更新问题以显示我在 gulpfile 中拥有的内容的 sn-p。
    • 删除“typings/globals/core-js/index.d.ts”、“typings/globals/jasmine/index.d.ts”、“typings/globals/jquery/index.d. ts”、“typings/globals/node/index.d.ts”、“typings/index.d.ts”、“typings/modules/lodash/index.d.ts”,来自 tsconfig.json 文件
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 2020-01-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多