embedDecoratorMetadata及其在转码中的重要性 [英] emitDecoratorMetadata and its importance in transpiled code

查看:209
本文介绍了embedDecoratorMetadata及其在转码中的重要性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇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 ,对排除输出没有影响.默认情况下,emitDecoratorMetadatafalse.装饰器仍然可以工作,但是设计时间信息在运行时不可用.

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及其在转码中的重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆