@esfx/metadata-shim Package

    Provides a global shim that adds minimal @esfx/metadata functionality to the Reflect global object. This provides limited compatibility with TypeScript's --emitDecoratorMetadata flag.

    Installation

    npm i @esfx/metadata-shim
    

    Usage

    • TypeScript
    import "@esfx/metadata-shim";
    import { getPropertyMetadata } from "@esfx/metadata";
    
    // TypeScript compiled with --emitDecoratorMetadata
    class MyClass {
        @someDecorator
        method(x: number): string {
            return "";
        }
    }
    
    const c = new MyClass();
    getPropertyMetadata(c, "method", "design:returntype"); // String
    getPropertyMetadata(c, "method", "design:paramtypes"); // [Number]
    
    • Improve this Doc
    Generated by DocFX