angularjs - tsconfig.json : using TypeScript in a team with Atom and VSCode?

标签 angularjs typescript namespaces visual-studio-code atom-editor

正如问题的标题所示,我们是一个团队,使用 TypeScript,但编辑器是 Atom 和 VSCode。我们在使用 tsconfig.json 时遇到问题.

  • VSCode 无法识别类型,因此 ng (对于 Angular 1.x)不是 VSCode 的已知命名空间。
  • 以下 tsconfig.json 被 VSCode 注释为

    Matches a schema that is not allowed.


  • 我想,这些问题之间存在联系。
    {
        "compilerOptions":
            {
                "target": "es5",
                "module": "commonjs",
                "declaration": false,
                "noImplicitAny": false,
                "removeComments": true,
                "noLib": false,
                "preserveConstEnums": true,
                "suppressImplicitAnyIndexErrors": true,
                "outDir": "./tmp/typescript",
                "rootDir": "./our/ts/dir"
            },
        "filesGlob": [
            "./src/**/*.ts",
            "!./node_modules/**/*.ts",
            "./bower_components/our_library/src/company/**/*.ts",
            "./typings/tsd.d.ts"
        ],
        "files": [
            "./src/example.ts",
            "./src/many/many/entries/any.ts",
            "./src/lib.ts/a_library.ts",
            "./src/lib.ts/angular.ts",
            "./src/lib.ts/jquery.ts",
            "./src/lib.ts/lodash.ts",
            "./src/lib.ts/moment.ts",
            "./src/lib.ts/restangular.ts",
            "./src/lib.ts/selectize.ts",
            "./src/lib.ts/systemjs.ts",
            "./typings/tsd.d.ts"
        ],
        "exclude": [],
        "atom": {
            "rewriteTsconfig": true
        }
    }
    

    我已尝试根据 this question 管理该问题,但答案没有帮助(打字已经包含在 tsconfig.json 中)。还在阅读 tsconfig.json spec 不是很有帮助,因为当我删除 filesGlob 时会出现来自 VSCode 的错误消息和 atom JSON 中的字段。

    任何建议表示赞赏。

    最佳答案

    对于问题 2:

    您必须删除 exclude属性(property)。如果与files一起使用属性(property)files属性(property)优先。

    您可以在此处阅读有效 tsconfigs 的完整规范:
    https://github.com/Microsoft/TypeScript/wiki/tsconfig.json

    关于angularjs - tsconfig.json : using TypeScript in a team with Atom and VSCode?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36150876/

    相关文章:

    typescript - 函数参数解构的 TSLint 错误

    ruby-on-rails - 我应该命名 STI 模型吗?

    javascript - 为什么 AngularJs 范围复选框不与内部属性同步?

    javascript - AngularJS 工厂返回类型未定义

    javascript - 如何告诉 typescript ,那个过程不是未定义的?

    reactjs - 如何在 Storybook 中添加样式 Prop 作为控件?

    javascript - 无法读取 Angular 移动设备中未定义的属性 'makeCurrent'

    javascript - Angular 三元运算符?具有功能

    variables - 如何访问由 Go 中的变量隐藏的命名空间?

    python - 已声明但未使用的命名空间扰乱了我的解析