From 72ef2c53acd2c24798b1c6427f932ef7814eb5db Mon Sep 17 00:00:00 2001 From: Ignat Shining Date: Mon, 25 Jul 2016 00:29:11 +0300 Subject: [PATCH] docs(dependency-injection): Clarify how TypeScript generates decorator metadata I think it's important to mention the compiler option. I wanted to see how this magic works and what it looks like in a compiled javascript and tried to make a simple test in TypeScript playground. I got nothing and it took me some time to figure out that a compiler option is involved in this. --- public/docs/ts/latest/guide/dependency-injection.jade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/docs/ts/latest/guide/dependency-injection.jade b/public/docs/ts/latest/guide/dependency-injection.jade index 759f303791..4a6b7aaf86 100644 --- a/public/docs/ts/latest/guide/dependency-injection.jade +++ b/public/docs/ts/latest/guide/dependency-injection.jade @@ -432,7 +432,8 @@ block injectable-not-always-needed-in-ts :marked Injectors use a class's constructor metadata to determine dependent types as identified by the constructor's parameter types. - TypeScript generates such metadata for any class with a decorator, and any decorator will do. + TypeScript generates such metadata for any class with a decorator (if + `emitDecoratorMetadata` compiler option is set to true), and any decorator will do. But of course, it is more meaningful to mark a class using the appropriate InjectableMetadata #{_decorator}.