在哪里可以找到 reflect-metadata 中使用的 metadataKey 值

Where do I find the metadataKey values used in reflect-metadata

我正在使用打字稿和 Angular (2.4.7)

reflect-metadata 指的是神奇的字符串,我在哪里可以找到它们是什么,它们在哪里定义?例如"design:type"

function Type(type) { return Reflect.metadata("design:type", type); }
function ParamTypes(...types) { return Reflect.metadata("design:paramtypes", types); }
function ReturnType(type) { return Reflect.metadata("design:returntype", type); }

它来自启用了 emitDecoratorMetadata 选项的 typescript 编译器

https://github.com/Microsoft/TypeScript/blob/ef25b25c1fb64602f99a6278f24d42c1b6d53d90/src/compiler/transformers/ts.ts#L1360-L1376

https://github.com/Microsoft/TypeScript/blob/ef25b25c1fb64602f99a6278f24d42c1b6d53d90/src/compiler/transformers/ts.ts#L1498-L1528