Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing type definitions "inExperiment" #91

Open
nethan-freely opened this issue May 11, 2023 · 1 comment
Open

Adding missing type definitions "inExperiment" #91

nethan-freely opened this issue May 11, 2023 · 1 comment

Comments

@nethan-freely
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

We're using the result of inExperiment from LDEvaluationReason so we're patching it locally as it's not in the type definitions
https://docs.launchdarkly.com/sdk/concepts/evaluation-reasons

Here is the diff that solved my problem:

diff --git a/node_modules/launchdarkly-js-sdk-common/typings.d.ts b/node_modules/launchdarkly-js-sdk-common/typings.d.ts
index a3bd0d5..5fbdabb 100644
--- a/node_modules/launchdarkly-js-sdk-common/typings.d.ts
+++ b/node_modules/launchdarkly-js-sdk-common/typings.d.ts
@@ -589,6 +589,13 @@ declare module 'launchdarkly-js-sdk-common' {
      * The key of the failed prerequisite flag, if the kind was `'PREREQUISITE_FAILED'`.
      */
     prerequisiteKey?: string;
+
+    /**
+     *  inExperiment is an optional attribute on the reason object that indicates whether the context was evaluated as part of an experiment:
+     *  If inExperiment is true, LaunchDarkly includes the event in experimentation analysis
+     *  If inExperiment is false, LaunchDarkly does not include this attribute in the reason object
+     */
+    inExperiment?: boolean;
   }
 
   /**

This issue body was partially generated by patch-package.

@kinyoklion
Copy link
Member

Hello @nethan-freely,

Thank you for reaching out. We will be including this in the type definitions in a future version.

Thank you,
Ryan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants