TypeScript MIT

reflection

Lightweight (3K) ES Module implementation of reflect-metadata

A

abraham

Dernière activité 3 août 2026
abraham/reflection

284

étoiles

15

forks

4

issues ouvertes

decoratorshacktoberfestjavascriptmetadatareflect-metadatatypescript

Ce README est souvent en anglais.

Version Status Build Status npm bundle size (minified + gzip) Coverage Status

Reflection

Lightweight ES Module implementation of reflect-metadata to work with TypeScript's experimental decorator support.

Why?

The main reason for this library is to provide a much smaller implementation that can be included as a module.

  • ES module
    • reflection can be loaded with <script type="module" src="https://raw.githubusercontent.com/abraham/reflection/HEAD/..."></script>
  • Size (uncompressed)

Read about how to drop 20K from your production Angular app by switching to this.

Install

npm install @abraham/reflection

Usage

import '@abraham/reflection';
Reflect.defineMetadata(metadataKey, metadataValue, target);

You can also import Reflection:

import { Reflection as Reflect } from '@abraham/reflection';
Reflect.defineMetadata(metadataKey, metadataValue, target);

API

Reflection does not currently cover the complete API surface of reflect-metadata. The following methods are available:

Reflect.decorate(...);
Reflect.defineMetadata(...);
Reflect.getMetadata(...);
Reflect.hasMetadata(...);
Reflect.getOwnMetadata(...);
Reflect.hasOwnMetadata(...);
Reflect.metadata(...);

Projets similaires

Prototype for a Metadata Reflection API for ECMAScript

TypeScriptdecorator-metadatajavascriptmetadata
Mmicrosoft
3,4 k étoiles191

Babel plugin to emit decorator metadata like typescript compiler

TypeScriptbabelbabel-pluginbabel-typescript
Lleonardfactory
223 étoiles19

Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.

PHPhacktoberfest
RRoave
1,2 k étoiles137