@nestjs/core
Version:
Nest - modern, fast, powerful node.js web framework (@core)
30 lines (29 loc) • 1.03 kB
TypeScript
import { Type } from '@nestjs/common';
/**
* Helper class providing Nest reflection capabilities.
*
* @see [Reflection](https://docs.nestjs.com/guards#putting-it-all-together)
*
* @publicApi
*/
export declare class Reflector {
/**
* Retrieve metadata for a specified key for a specified target.
*
* @example
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
*
* @param metadataKey lookup key for metadata to retrieve
* @param target context (decorated object) to retrieve metadata from
*
*/
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
/**
* Retrieve metadata for a specified key for a specified set of targets.
*
* @param metadataKey lookup key for metadata to retrieve
* @param targets context (decorated objects) to retrieve metadata from
*
*/
getAll<TResult extends any[] = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
}