我正在按照Google的说明首次使用Jasmine测试:http://devdocs.io/angular~2_typescript/guide/testing我使用的是Angular 2.1.2,Typescript 2.0.7,其他支持组件也是最新的 . 我的app.component.spec.ts文件与app.component.ts文件位于同一目录/文件夹中 . Atom Typescript说我在任何文件中都没有错误 . 我在core-js,jasmine和node上运行了以下命令,以便为它们提供当前的d.ts文件 .

npm install @types/jasmine --save-dev

我的app.component.spec.ts有来自Angular2的同名QuickStart文件的代码,加上devdocs指南的第一个测试,即:

describe('1st tests', () => {
  it('true is true', () => expect(true).toBe(true));
});

我希望这个测试是真的,并且Quickstart测试是假的(因为我没有构建Quickstart应用程序) . 两条消息都没有出现 .

相反,我在Node控制台中收到了 hundreds 行错误消息 . 它们中的大多数似乎是几个支持组件中的d.ts错误,例如Angular2,core-js,angular / material,hammerjs,typings / global / node / index.d.ts等 . 我不知道是怎么回事 .

常用组件的错误消息的原因是什么?我需要发布哪些进一步的信息才能解决这个问题?

我的错误消息的一些示例是:

node_modules/@angular/core/src/util/decorators.d.ts(11,5): error TS2411: Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.

node_modules/@angular/forms/src/model.d.ts(544,9): error TS2459: Type '{ onlySelf?: boolean | undefined; } | undefined' has no property 'onlySelf' and no string index signature.

node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(25,22): error TS2420: Class 'DomRenderer' incorrectly implements interface 'Renderer'.
  Types of property 'animate' are incompatible.
    Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number,...'.

typings/globals/typescript/index.d.ts(1289,9): error TS2411: Property 'charset' of type 'string | undefined' is not assignable to string index type 'string | number | boolean'.

typings/globals/core-js/index.d.ts(1501,5): error TS2300: Duplicate identifier 'export='.

typings/globals/node/index.d.ts(570,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
  Named property 'once' of types 'EventEmitter' and 'Server' are not identical.
typings/globals/node/index.d.ts(570,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.

node_modules/@angular/material/core/gestures/MdGestureConfig.d.ts(2,22): error TS2415: Class 'MdGestureConfig' incorrectly extends base class 'HammerGestureConfig'.
  Types of property 'buildHammer' are incompatible.
    Type '(element: HTMLElement) => HammerManager' is not assignable to type '(element: HTMLElement) => HammerInstance'.