TypeScript 1.5 beta brings cosmetic metadata support

Source: Internet
Author: User

(This article is also published in my public number "dotnet daily Essence article")

Today, because of a little cold, it is not a long speech, a brief introduction and vs. RC release of Typescript 1.5 beta new features-decorated metadata.

At the Build 2015 conference, Microsoft released the typescript 1.5 Beta with Visual Studio RC, which allows you to learn about Typescript's future development progress. Microsoft provides VS2015 RC, VS2013, NPM, and source code installation methods, respectively.

TypeScript 1.5 Beta The biggest change is the introduction of the properties of the decorated metadata (Decorator Metadata), which allows you to add and read metadata at the time of declaration. The purpose of this feature is to provide metadata support for other libraries (such as angular 2 and Aurelia) in the future, allowing these libraries to automatically set features like dependency injection.

The specific wording is as follows:

///<reference path= "node_modules\reflect-metadata\reflect-metadata.d.ts"/>Import "Reflect-metadata"; function Myclassdecorator (value:string) {returnfunction (target:function) {Reflect.definemetadata ("Myclassdecorator",value, target); }} @MyClassDecorator ("My metadata")classMyClass {}var MyClass =NewMyClass (); letvalue:string= Reflect.getmetadata ("Myclassdecorator", Myclass.constructor); Console.log (value);//outputs "my metadata"

More details can be "read the original".

Original address: Http://blogs.msdn.com/b/typescript/archive/2015/04/30/announcing-typescript-1-5-beta.aspx

TypeScript 1.5 beta brings cosmetic metadata support

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.