I think you are missing the point here. The whole idea of TypeScript and Reflect is to bring JS world closer to high level programming languages, like Java and C#.
Yeah, sure, you can do it as close to native JS as possible, but then again, why bother with TS? Your basic argument is not against reflect-metadata, but whole concept of using typescript. Yeah, you might be vendor-locking yourself, but you do so too, whenever you use any framework for development. You are locked with that framework for the rest of the project, unless you expect some major refactoring.
...which enforces you to do extra compilation to make the code work...
Well, that's basically TS.
So tell me - whoever read this comment after this article - do you want to trade code clarity to stay "pure"? Just because you can achieve same thing harder in native way, does it mean, you have to?
For me, it's just waste of time and energy.
What if you don't understand decorators, reflections and aspect programming? Don't worry, in 90% cases you don't have to.
You're right in one thing... C# & Java sucks as well
I think that you absolutely miss understand the whole point of this article... i can't imagine to write out more code without typescript and I think that TS type system is the best type system ever because you can infer almonost all types from your pure javascript code and keep 100% type safeness. Imho there is only one similar good type system and its from F# compiler. i do not blame TS, i love it... but my code looks like JS and works like TS <3 its 2 in 1, win win situation
BTW reflect-metadata is not as powerfull as the type inferring system for more complicated data types like structures etc...
its reason why you have to define pointer into Photo two times in this example:
@OneToOne(type=>Photo)@JoinColumn()// here you duplicate the pointer into Photo just to have proper static typesphoto:Photo;
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think you are missing the point here. The whole idea of TypeScript and Reflect is to bring JS world closer to high level programming languages, like Java and C#.
Yeah, sure, you can do it as close to native JS as possible, but then again, why bother with TS? Your basic argument is not against reflect-metadata, but whole concept of using typescript. Yeah, you might be vendor-locking yourself, but you do so too, whenever you use any framework for development. You are locked with that framework for the rest of the project, unless you expect some major refactoring.
So tell me - whoever read this comment after this article - do you want to trade code clarity to stay "pure"? Just because you can achieve same thing harder in native way, does it mean, you have to?
For me, it's just waste of time and energy.
What if you don't understand decorators, reflections and aspect programming? Don't worry, in 90% cases you don't have to.
You're right in one thing... C# & Java sucks as well
I think that you absolutely miss understand the whole point of this article... i can't imagine to write out more code without typescript and I think that TS type system is the best type system ever because you can infer almonost all types from your pure javascript code and keep 100% type safeness. Imho there is only one similar good type system and its from F# compiler. i do not blame TS, i love it... but my code looks like JS and works like TS <3 its 2 in 1, win win situation
BTW reflect-metadata is not as powerfull as the type inferring system for more complicated data types like structures etc...
its reason why you have to define pointer into
Photo
two times in this example: