microsoft / microsoft/reflect-metadata
Ability to collect defined metadata property names
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.4k
- Forks
- 190
- Avg merge
- 13h 52m
- Merged PRs (30d)
- 1
Description
Is there a way to collect the decorated property names from a prototype without knowing the property names in advance?
It is a useful feature for an orm, ioc and other stuff.
Right know Reflect.getMetadataKeys(fn.prototype) returns an empty array. It would be useful to return the annotated property names if the second argument is undefined.
Maybe Reflect.getMetadataPropertyNames(fn.prototype)
Example:
const fn:Function = ...;
const propertyNames = Reflect.getMetadataKeys(fn.prototype);
for (const name of propertyNames){
const cachable = Reflect.hasMetadata("CachableMetaKey", fn.prototype, name);
if (cachable) {
//do stuff
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Reflect.getMetadataKeys(fn.prototype) behavior and the related metadata reflection API semantics. Compare the proposed optional-second-argument behavior with the alternative Reflect.getMetadataPropertyNames(fn.prototype) entry point, then define which API should expose decorated property names and how completion would be verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100