打字稿2茉莉花类型

时间:2016-09-12 16:38:20

标签: typescript visual-studio-2015 jasmine typescript2.0

我正在使用Typescript 2,除非我在我的规范文件的顶部放置/// <reference path="..." />,否则会收到错误Cannot find name 'describe'

这是我的spec文件:

/// <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();
    });
...

的package.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。

enter image description here

1 个答案:

答案 0 :(得分:1)

使用Typescript 2,尝试:

/// <reference types="jasmine" />

并确保你npm install @ types / jasmine

相关问题