• Overview
@angular/core

resolveForwardRef

function
stable

Lazily retrieves the reference value from a forwardRef.

API

function resolveForwardRef<T>(type: T): T;

resolveForwardRef

T

Lazily retrieves the reference value from a forwardRef.

Acts as the identity function when given a non-forward-ref value.

@paramtypeT
@returnsT
Usage notes

Example

{@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}

Description

Lazily retrieves the reference value from a forwardRef.

Acts as the identity function when given a non-forward-ref value.

Usage Notes

Example

const ref = forwardRef(() => 'refValue');      expect(resolveForwardRef(ref as any)).toEqual('refValue');      expect(resolveForwardRef('regularValue')).toEqual('regularValue');
Jump to details