Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genrics support ? #3

Open
bilby91 opened this issue Dec 12, 2017 · 1 comment
Open

Genrics support ? #3

bilby91 opened this issue Dec 12, 2017 · 1 comment
Labels

Comments

@bilby91
Copy link

bilby91 commented Dec 12, 2017

Hello,

I'm working on a ORM that heavily relies on Generics. I was wondering if the lib could be useful to introspect a object at runtime.

Use case:

interface ISchema {
  id: number,
  name: string
}

class Schema<T> { }

const schema = new Schema<ISchema>()

I want to be able to iterate over the properties of the generic type T, in the case of the schema object, ISchema.

Thanks!

@lilezek
Copy link
Owner

lilezek commented Dec 18, 2017

You can, as far as the generics are not interfaces.

As a future goal, I'd like to give metadata to interfaces too, but as they disappear totally from the JavaScript runtime it's a bit harder than giving metadata to classes.

Is it enough for you to work with classes instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants