8000 [BUG] TypeScript error with $opt_event_properties · Issue #303 · optimizely/react-sdk · GitHub
[go: up one dir, main page]

Skip to content

[BUG] TypeScript error with $opt_event_properties #303

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 an 8000 d privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
TwisterMc opened this issue Feb 17, 2025 · 3 comments
Open
1 task done

[BUG] TypeScript error with $opt_event_properties #303

TwisterMc opened this issue Feb 17, 2025 · 3 comments
Labels
acknowledged bug Something isn't working needs-triage

Comments

@TwisterMc
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

SDK Version

Source: https://docs.developers.optimizely.com/feature-experimentation/docs/usetrackevent-react

When you look at the example code it says:

  const [track] = useTrackEvent()

// Define event properties
  const properties = {
    "category": "shoes",
    "color": "red"
  };

  // Define tags including event properties
  const tags = {
    "revenue": 10000,
    "value": 100.00,
    "$opt_event_properties": properties
  };

  // Track event with tags
  track("signup-clicked", tags);

However, if you add that code to a TypeScript project, utilizing the useTrackEvent hook, it expects $opt_event_properties: properties to be a string.

Image

Current Behavior

Code is throwing a TypeScript error.

Expected Behavior

Code should not throw a TypeScript error.

Steps To Reproduce

  1. Paste the example code from https://docs.developers.optimizely.com/feature-experimentation/docs/usetrackevent-react into a TypeScript project.
  2. See error

React Framework

NextJS 13.5.6

Browsers impacted

No response

Link

No response

Logs

No response

Severity

No response

Workaround/Solution

No response

Recent Change

No response

Conflicts

No response

@TwisterMc TwisterMc added bug Something isn't working needs-triage labels Feb 17, 2025
@junaed-optimizely
Copy link
Contributor

Hey @TwisterMc, I have checked and seems like this is a valid type issue in the JS SDK. Fixing JS will automatically resolve the issue in React end. I have created an internal ticket FSSDK-11197 to track this.

Thanks!

@RowMur
Copy link
RowMur commented May 1, 2025

Hey @junaed-optimizely, any updates on this?

@junaed-optimizely
Copy link
Contributor
junaed-optimizely commented May 2, 2025

Hey @RowMur , we have a open JS SDK PR regarding this. As soon as that gets out in a release, will update this!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

3 participants
0