UNPKG

1.82 kBTypeScriptView Raw
1import { Type } from '@nestjs/common';
2/**
3 * Helper class providing Nest reflection capabilities.
4 *
5 * @see [Reflection](https://docs.nestjs.com/guards#putting-it-all-together)
6 *
7 * @publicApi
8 */
9export declare class Reflector {
10 /**
11 * Retrieve metadata for a specified key for a specified target.
12 *
13 * @example
14 * `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
15 *
16 * @param metadataKey lookup key for metadata to retrieve
17 * @param target context (decorated object) to retrieve metadata from
18 *
19 */
20 get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
21 /**
22 * Retrieve metadata for a specified key for a specified set of targets.
23 *
24 * @param metadataKey lookup key for metadata to retrieve
25 * @param targets context (decorated objects) to retrieve metadata from
26 *
27 */
28 getAll<TResult extends any[] = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
29 /**
30 * Retrieve metadata for a specified key for a specified set of targets and merge results.
31 *
32 * @param metadataKey lookup key for metadata to retrieve
33 * @param targets context (decorated objects) to retrieve metadata from
34 *
35 */
36 getAllAndMerge<TResult extends any[] = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
37 /**
38 * Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.
39 *
40 * @param metadataKey lookup key for metadata to retrieve
41 * @param targets context (decorated objects) to retrieve metadata from
42 *
43 */
44 getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
45}