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

Typescript error when using secret #227

Open
penfold45 opened this issue Dec 12, 2023 · 2 comments
Open

Typescript error when using secret #227

penfold45 opened this issue Dec 12, 2023 · 2 comments
Assignees
Milestone

Comments

@penfold45
Copy link

In commit 600d6ab.
InitConfig was updated as per bellow
However secret is not listed here.
I assume this was not intentional as the option is still defined in README.

Obviously now I have typescript issues

  export interface InitConfig {
  -  [key: string]: any;
  +  test: boolean;
  +  debug: boolean;
  +  verbose: boolean;
  +  host: string;
  +  protocol: string;
  +  path: string;
  +  keepAlive: boolean;
  +  geolocate: boolean;
  +  logger: CustomLogger;
  }
@willemclarke
Copy link

willemclarke commented Dec 14, 2023

I have same issue as OP - basically for node-js SDK it seems the import method requires initialising Mixpanel with both project token and secret. Given the type of InitConfig was just Record<string, any> before is it just a matter of adding a secret: string to InitConfig?

As taken from readme:

var mixpanel_importer = Mixpanel.init('valid mixpanel token', {
    secret: 'valid api secret for project'
});

edit: I see theres currently an open PR for this exact issue: #225

edit: as a workaround, albeit not ideal - you can just typecast the config object

  this.mixpanel = Mixpanel.init(projectToken, {
        debug: true,
        secret: "YOUR_SECRET",
      } as unknown as Mixpanel.InitConfig);

@austinpray-mixpanel austinpray-mixpanel self-assigned this May 14, 2024
@austinpray-mixpanel
Copy link

austinpray-mixpanel commented May 14, 2024

Seeing same thing
image

library is aware that this config is needed:
image

Will sling a PR to make this go away

@austinpray-mixpanel austinpray-mixpanel added this to the v0.19.0 milestone May 15, 2024
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

3 participants