Questions tagged [reflect-metadata]
83 questions
1
vote
1 answer
Cannot Inject Dependency Into Derived Class
I have a relatively simple setup with three classes. I am using inversify for dependency injection. But when injecting the class MessageBroker into the derived class Repository the MessageBroker is undefined:
import 'reflect-metadata';
import {…

Florian Ludewig
- 4,338
- 11
- 71
- 137
1
vote
1 answer
Typescript decorator: get class decorator value from method decorator
I have a class decorator (fooAnnotation) and method decorator (barDecorator).
import 'reflect-metadata';
function fooAnnotation(value: string){
console.log('fooAnnotation init...');
return (target: any): void => {
console.log('fooAnnotation…

Fabio Formosa
- 904
- 8
- 27
1
vote
0 answers
vue-property-decorator @Prop validator via reflect-metadata does not work after refreshing the page
Just as the title, @Prop validator via reflect-metadata does not work after refreshing the page.
As the doc says, I import reflect-metadata and turn emitDecoratorMetadata to true.
And my code is just like this:
…

Wen Sun
- 11
- 3
1
vote
0 answers
how to access a class decorator's parameters from a method decorator
I would like to use the information passed to class decorator from a method decorator on the same class. Here is what the (dummy) class looks like:
@classDecorator({
something: 'very interesting'
})
class MyClass{
@methodDecorator({
pure:…

Hoff
- 38,776
- 17
- 74
- 99
1
vote
0 answers
Angular Metadata ImportAs
Curious if anyone has or knows how to get more information regarding Angulars use of metadata? Specifically I am looking for what and where the importAs property is being used by Angular? It is created in the metadata when the angularCompilerOptions…

Danny Fenstermaker
- 914
- 10
- 12
1
vote
1 answer
Typescript Reflect.getMetadata design:type returns Object instead of Date without angular testbed
I want to start by saying it is not a duplicate of Typescript Reflect.getMetadata('design:type'..) returns Object instead of Date if the Angular 2 Stack is used but is similar.
The following code:
import {} from 'reflect-metadata';
import…

Aleksandr Belkin
- 412
- 5
- 17
1
vote
1 answer
Why doesn't Reflect object have `defineMetadata` and `getOwnMetadata` methods
I'm looking at this reflect-metadata shim, it shows methods available on Reflect object like Reflect.defineMetadata and Reflect.getOwnMetadata. The MDN page on Reflect object doesn't list these methods. Are those two different Reflect objects?

Max Koretskyi
- 101,079
- 60
- 333
- 488
1
vote
1 answer
Angular2 Failing to update to RC7 - zone.js & reflect-metadata
I'm trying to get my application to run with the new RC7 of angular but i cant seem to be able to get it done, as the console shouts:
Promise rejection: Zone.assertZonePatched is not a function angular2-polyfills.js:489
And when this somehow…

Kesem David
- 2,135
- 3
- 27
- 46
1
vote
2 answers
Typescript: decorators behave differently on angular project and typescript playground
I need to serialize an object to json in angular 2.0.0-rc1 when I found out that Typescript's private isn't private at all, and get set property are not outputted through JSON.stringify.
So I set out to decorate the class:
//method…

Evan
- 492
- 1
- 3
- 15
0
votes
0 answers
Webpack is not importing reflect-metadata properly with chunking
recently I've been trying to convert my aws-lambda project from outputting cjs to esm. The only thing left that doesn't work is my usage of reflect-metadata. In this project I also do chunking:
optimization: {
minimize: false,
…

kyl
- 475
- 1
- 5
- 16
0
votes
0 answers
Getting a compile error when trying to use class-transformer
I'm receiving the following error with a simple example using class-transformer.
error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'ClassFieldDecoratorContext & { name:…

Danno
- 933
- 4
- 13
- 30
0
votes
0 answers
Typescript Decorators Class target prototype always empty
I try to learn decorators in typescript and follow the instruction of the course till in function controller it's a function try to loop through class Plane property to get Metadata out of it from secret but it can't loop through because the…

panupat
- 9
- 1
0
votes
0 answers
TypeError when initializing entity using typeorm with React Native
I have set up typeorm with React Native & quick SQLLite according to the instructions, and I seem to be having an issue even registering an entity. My setup code looks like:
import { typeORMDriver } from 'react-native-quick-sqlite'
import {…

MDalt
- 1,681
- 2
- 24
- 46
0
votes
0 answers
How to get all decorated classes in Node.js?
I have many decorated classes in different files. Is it possible to get all these classes in one place using a decorator?
In addition, I use the tsyringe library to create decorators. Maybe it has the ability to get classes by decorator?
`export…

Dmitry Belov
- 41
- 3
0
votes
1 answer
How to change the OG url in a Twitter card with metadata?
Example card
I would like to change the bbc.com URL to another URL. I have changed the metadata within my HTML, but it seems to keep showcasing 'bbc.com'. There is other people who are able to succesfully change it to display another URL.
I have…