我使用"ASP.NET (.NET Core)“空项目模板创建了一个项目。我正在https://angular.io/guide/quickstart做Angular2快速入门教程。这一切都很好,我已经开始了快速项目的工作。
问题是,现在我开始添加自己的TypeScript文件,Angular2的intellisense似乎不起作用。
我安装了TypeScript 1.8.10。
在我的package.json中,我使用的是@角/依赖项,如下所示;
{
"name": "product-management",
"version": "1.0.0",
"author": "Deborah Kurata",
"description": "Package for the Acme Product Management sample application",
"scripts": {
"start": "concurrently \"npm run tsc:w\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"postinstall": "typings install",
"gulp": "gulp"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"systemjs": "0.19.29",
"core-js": "2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"angular2-in-memory-web-api": "0.0.11",
"bootstrap": "3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"typescript": "^1.8.10",
"typings": "1.0.4",
"gulp": "3.9.1",
"gulp-clean": "0.3.2"
},
"repository": { }
}这是我的tsconfig.json文件;
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"noImplicitAny": true,
"noEmitOnError": true,
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"compileOnSave": true
}和我的typings.json文件;
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}“类型”文件夹已自动创建在“我的项目”的根目录中,其中包含用于上述库类型的文件夹。
这是我的项目结构;
当我查看“node_ folder /@ visual /”文件夹时,我可以看到它们包含用于TypeScript定义的TypeScript文件,但是正如您可以看到的图像一样,这个文件夹在我的项目中没有“包含”,所以我不确定visual是否正在使用.d.ts文件.?
我一直在寻找答案,但很多帖子并不是基于使用Visual 2015,而是使用了较旧的"angular2“依赖关系,而不是新的”@角形“依赖结构。
有人能告诉我检查/配置什么才能使TypeScript intellisense在visual 2015中与Angular2一起工作吗?
最后,当我说它不起作用时,如果我添加了一个像"file.ts“这样的文件,然后尝试键入类似@Component (应该击中Angular2 intellisense)之类的内容,它就不会并且将建议使用"Component”的其他点击。
谢谢你的帮助。
发布于 2016-06-06 12:45:01
我意识到我的智力问题与我写打字文件的顺序有关.(很丢人)。
当我首先在顶部写导入语句时,即
import { Component } from "@angular/core"然后开始写下面的角度,intellisense工作得很好。
@Component({
})
export class AppComponent {
pageTitle: string = "Acme Product Management";
}https://stackoverflow.com/questions/37655112
复制相似问题