我正在使用 Typescript 2,除非我将 a/// <reference path="..." />
放在我的规范文件的顶部,否则我会收到一个错误Cannot find name 'describe'
这是我的规格文件:
/// <reference path="../../../../node_modules/@types/jasmine/index.d.ts" />
import { DashboardSlotComponent } from './dashboard-slot.component';
import { DashboardSlot } from './dashboard-slot.model';
describe('Given a dashboard slot component', () => {
let sut: DashboardSlotComponent;
beforeEach(() => {
sut = new DashboardSlotComponent();
});
...
包.json
"typescript": "2.0.2",
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": [
],
"lib": [
"dom",
"es6"
],
"types": [
"angular",
"hammerjs",
"jasmine",
"node",
"selenium-webdriver",
"source-map",
"uglify-js",
"webpack"
]
},
"exclude": [
"dist",
"node_modules"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
我正在使用带有 Typescript 2 扩展的 Visual Studio 2015。