10

I'm currently learning TypeScript with Node. Reading about TypeORM, I saw that the reflect-metadata package is needed for TypeORM to work. What is the reason for this package being needed?

kaya3
  • 47,440
  • 4
  • 68
  • 97
Erik
  • 159
  • 2
  • 11
  • Why do you think it isn't? Please offer some reasoning as to why you think it wouldn't be so that we can help you understand the utility of the package. – zero298 Apr 02 '18 at 21:02
  • Well, you say to the orm what are the entities he must map. So i don't understand why the orm needs additional data (i came from jpa because that i don't understant it) – Erik Apr 02 '18 at 21:13

1 Answers1

20

With the reflect-metadata package you can do runtime reflection on types. Since TypeORM mostly works with decorators (like @Entity or @Column), this package is used to parse these decorators and use it for building sql queries.

The following link provides detailed information about what this package is capable of: http://blog.wolksoftware.com/decorators-metadata-reflection-in-typescript-from-novice-to-expert-part-4.

JudgeFudge
  • 1,749
  • 13
  • 18