Angular 角度4“;出口';AnimationEvent';在'@角度/动画';

Angular 角度4“;出口';AnimationEvent';在'@角度/动画';,angular,typescript,animation,Angular,Typescript,Animation,角度版本4.3.2 @angular/cli版本1.2.6 我正在为导入的组件使用TypeScript(v2.4.2) import {animate, AnimationEvent, state, style, transition, trigger} from '@angular/animations'; 我收到警告说 在“@angular/animations”中未找到导出“AnimationEvent” 其他功能(动画、状态、样式等)不会触发警告。我发现node_modules/@an

角度版本4.3.2

@angular/cli版本1.2.6

我正在为导入的组件使用TypeScript(v2.4.2)

import {animate, AnimationEvent, state, style, transition, trigger} from '@angular/animations';
我收到警告说

在“@angular/animations”中未找到导出“AnimationEvent”

其他功能(动画、状态、样式等)不会触发警告。我发现node_modules/@angular/animations.d.ts中的@angular代码包括

export * from './public_api';
和/公共_api.d.ts已

export * from './src/animations';
和./src/animations.d.ts

export { AnimationBuilder, AnimationFactory } from './animation_builder';
export { AnimationEvent } from './animation_event';
export { AUTO_STYLE, AnimateChildOptions, AnimateTimings, AnimationAnimateChildMetadata, AnimationAnimateMetadata, AnimationAnimateRefMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationMetadataType, AnimationOptions, AnimationQueryMetadata, AnimationQueryOptions, AnimationReferenceMetadata, AnimationSequenceMetadata, AnimationStaggerMetadata, AnimationStateMetadata, AnimationStyleMetadata, AnimationTransitionMetadata, AnimationTriggerMetadata, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, ɵStyleData } from './animation_metadata';
export { AnimationPlayer, NoopAnimationPlayer } from './players/animation_player';
export * from './private_export';
和./animation\u event.d.ts具有接口定义

export interface AnimationEvent {
    fromState: string;
    toState: string;
    totalTime: number;
    phaseName: string;
    element: any;
    triggerName: string;
}
如果我将接口定义复制到我的代码中,一切都会正常工作

所有这些都与我使用的许多其他导入非常相似,但这是唯一一个生成警告的导入


如何在不将接口定义复制到代码中的情况下防止这些警告?

app module.ts:是否导入了BrowserAnimationsModule

参见文档中的

还有一个扑救者

如果这不能解决问题:

  • 记下system.config.js在Plunker中正在做什么
  • 另一个相关资源是

太长了,读不下去了。(<)< BrowserAnimationsModule >,我确实输入了“我的”,我的所有动画都在按预期的方式运行。事实上,除了编译器警告,所有的东西都在运行和工作。TL;DR通过改变TSCONTIONS JS编译程序。在iler配置中,我分析了Plunker中的systemjs.config.js,以与我的(Angular CLI生成的)进行比较tsconfig.app.json文件。只有两个区别,1)noImplicitAny:true,和2)module:'commonjs'。我一次更改一个。TypeScript文档声明模块类型是commonjs,所以我使用了它。我希望此更改不会导致其他问题…--noImplicitAny使用隐含“any”类型。因此可能没有必要这样做。但很高兴您解决了它。我应该说我已将noImplicitAny更改回其默认值,因为我有很多隐式“any”声明:)

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
  imports: [ BrowserModule, BrowserAnimationsModule ],
})