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

Feature request: Add export of avo event names to codegen output #348

Open
Aaronkala opened this issue Aug 3, 2023 · 2 comments
Open

Feature request: Add export of avo event names to codegen output #348

Aaronkala opened this issue Aug 3, 2023 · 2 comments

Comments

@Aaronkala
Copy link

Summary

We are using typescript in one of our projects and would love to get an list of available avo event names included in the codegen output.

Currently we are deducing the list of avo event names from the trigger functions with some typescript template literal type helpers:

const { initAvo, View, AvoEnv, LogType, EventName, ClickTarget, avoInspectorApiKey, ...events } =
  avo;

type AvoEventName = CamelCaseToSnakeCase<keyof typeof events>;

Our solution is fine, if the event names always stay the same as the function names but just in a different casing. If this connection changes, our solution will break.

@bragur
Copy link
Contributor

bragur commented Aug 21, 2023

Hey @Aaronkala, sorry for the late response. We’re regrouping after summer vacations and Github has been neglected in the meantime. I’ll make sure your request gets relayed to the team with a response imminent.

@thoragudf
Copy link

Hi @Aaronkala !

We are not planning to change the connection between the event and function name, so your solution should continue working.

We also print a list of all event names on the last line of the generated file and it's not going to change too, so if you are interested in exploring other hacky ways to get the names, you can use that.

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