对不起大家,我一直在努力理解为什么我需要
/// <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 2015
与 ReSharper
, 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 文件。
或者,您可以使用 import
和 export
模块语法。
关于angularjs - 如何摆脱<引用路径=,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36037962/