问题描述
我很好奇emitDecoratorMetadata
选项在将TypeScript转换为JavaScript(在Angular 2上下文中)的重要性.如果设置为false
,并且元数据将不包含在结果代码中,它将产生什么作用?
I am curious about the importance of the emitDecoratorMetadata
option in transpiling TypeScript to JavaScript (in Angular 2 context). If set to false
, and metadata will not be included in resulting code, what effect will it have?
推荐答案
如果要在运行时反映元数据,则需要装饰器元数据.
The decorator metadata is needed if you want to reflect over the metadata at runtime.
如果您不这样做,例如使用 Reflect.metadata ,对排除输出没有影响.默认情况下,emitDecoratorMetadata
为false
.装饰器仍然可以工作,但是设计时间信息在运行时不可用.
If you are not doing this, for example with Reflect.metadata, there is no impact in excluding the output. By default, emitDecoratorMetadata
is false
. Decorators still work, but the design time information is not available at runtime.
这篇关于embedDecoratorMetadata及其在转码中的重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!