|
1 | | -import { LDEvaluationDetailTyped as CommonLDEvaluationDetailTyped, LDEvaluationReason, } from '@launchdarkly/js-client-sdk-common'; |
| 1 | +import { |
| 2 | + LDEvaluationDetail as CommonDetail, |
| 3 | + LDEvaluationDetailTyped as CommonDetailTyped, |
| 4 | + LDEvaluationReason, |
| 5 | +} from '@launchdarkly/js-sdk-common'; |
| 6 | + |
| 7 | +// Implementation note: In client-side SDKs the reason is optional. The common type, which is also |
| 8 | +// used by server SDKs, has a required reason. This file contains a client specific |
| 9 | +// LDEvaluationDetail which has an optional reason. |
| 10 | + |
| 11 | +// TODO: On major version change "reason" to be optional instead of nullable. |
2 | 12 |
|
3 | 13 | /** |
4 | 14 | * An object that combines the result of a feature flag evaluation with information about |
5 | 15 | * how it was calculated. |
6 | 16 | * |
7 | | - * This is the result of calling detailed variation methods. |
| 17 | + * This is the result of calling `LDClient.variationDetail`. |
| 18 | + */ |
| 19 | +export type LDEvaluationDetail = Omit<CommonDetail, 'reason'> & { |
| 20 | + /** |
| 21 | + * An optional object describing the main factor that influenced the flag evaluation value. |
| 22 | + */ |
| 23 | + reason: LDEvaluationReason | null; |
| 24 | +}; |
| 25 | + |
| 26 | +/** |
| 27 | + * An object that combines the result of a feature flag evaluation with information about |
| 28 | + * how it was calculated. |
8 | 29 | * |
9 | | - * @remarks |
10 | | - * We will be deprecating this type in favor of {@link CommonLDEvaluationDetailTyped} in the |
11 | | - * next major version. |
| 30 | + * This is the result of calling detailed variation methods. |
12 | 31 | */ |
13 | | -export type LDEvaluationDetailTyped<TFlag> = Omit<CommonLDEvaluationDetailTyped<TFlag>, 'reason'> & { |
| 32 | +export type LDEvaluationDetailTyped<TFlag> = Omit<CommonDetailTyped<TFlag>, 'reason'> & { |
14 | 33 | /** |
15 | 34 | * An optional object describing the main factor that influenced the flag evaluation value. |
16 | 35 | */ |
|
0 commit comments