typescript 什么是打字稿中的反射元数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45135878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:45:19  来源:igfitidea点击:

What is reflect-metadata in typescript

typescriptreflect-metadata

提问by Mantu Nigam

what are reflect-metadata and its purpose?

什么是反射元数据及其目的?

What is syntax and purpose of using reflect-metadata?

使用反射元数据的语法和目的是什么?

Can some one provide the example for better understanding of the same?

有人可以提供示例以更好地理解相同内容吗?

How can be the reflect metadata helpful in implementing decorators in typescript.

反射元数据如何有助于在打字稿中实现装饰器。

采纳答案by basarat

reflect-metadataAllows you to do runtime reflection on types.

reflect-metadata允许您对类型进行运行时反射。

The native (non reflect-metadata) version of type inference is much poorer than reflect-metadataand consists only of typeofand instanceof.

本机(非反射-元数据)类型推断的版本比穷得多reflect-metadata且仅由typeofinstanceof

More

更多的

This blog post covers its features well : http://blog.wolksoftware.com/decorators-metadata-reflection-in-typescript-from-novice-to-expert-part-4

这篇博文很好地介绍了它的功能:http: //blog.wolksoftware.com/decorators-metadata-reflection-in-typescript-from-novice-to-expert-part-4