When utilizing Typescript 2, I encountered an issue where I would receive an error stating 'Cannot find name 'describe'' unless I included a
/// <reference path="..." />
at the beginning of my spec files.
Here is an example of one of my spec files:
/// <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();
});
...
In my package.json file, I am using Typescript version 2.0.2:
"typescript": "2.0.2",
Below is my tsconfig.json configuration:
{
"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 }
}
I work in Visual Studio 2015 with the Typescript 2 extension enabled.