angularjs - 如何摆脱<引用路径=

标签 angularjs typescript visual-studio-2015 resharper typescript1.8

对不起大家,我一直在努力理解为什么我需要

/// <reference path="../typings/browser.d.ts" />

module App {
    angular.module("app", [""]);
}

我正在使用typings这是我的tsconfig :

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "module": "commonjs"
  },
  "files": [

  ],
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

我已经找到了几篇相关文章,但每次都有不同的答案和不同的场景。

我使用Visual Studio 2015ReSharper , TypeScript 1.8.5

一旦我删除 <reference...标签ReSharper“找不到名称'Angular'”,但应用程序运行正常。 (可能是因为它找不到智能感知了)

有人遇到过同样的问题吗?我错过了什么吗?

最佳答案

来自docs on tsconfig :

If no "files" property is present in a tsconfig.json, the compiler defaults to including all TypeScript (*.ts or *.tsx) files in the containing directory and subdirectories. When a "files" property is present, only the specified files are included.

您使用的是空文件数组 ("files": []),这意味着编译器上下文中不会包含任何文件。将所有引用添加到 files 数组,或者完全删除 files 属性,以允许编译器在上下文中包含所有 TS 文件。

或者,您可以使用 importexport 模块语法。

关于angularjs - 如何摆脱<引用路径=,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36037962/

相关文章:

angularjs - 为什么单选按钮在手机上不起作用?

需要 Angularjs Ui 网格分组格式

javascript - TypeScript 中的 Mongoose 方法范围

c# - Visual Studio 2015 无状态

android - Visual Studio Android 模拟器在创建虚拟机时卡住

javascript - 在 Angular-UI-Bootstrap Datepicker 中的设置日期(date=today)显示自定义字符串 ("Today")?

Typescript : recursive template literal type, 允许字符串和特定链接

javascript - 获取不正确的日期,将时间戳转换为新日期

c++ - 运算符 + 需要移动构造函数

angularjs - Angular.js : Wrapping elements in a nested transclude