-
Notifications
You must be signed in to change notification settings - Fork 53
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
React Native client only generates types for events that have properties #284
Comments
Just wanted to add to this, that the exact same happens for the JS client. Unless at least one custom property is defined in a tracking plan, Typewriter won't generate the typed method for it. |
@oscb Tagging for visibility. This is blocking us as well from migrating to v8. I tried going through to code in an attempt to fix it and open a PR, but couldn't figure out where exactly it goes wrong. My hunch is that because |
Also have this issue; is blocking me using the client |
Sorry for the lack of responses, we are a little short-staffed to keep up with Typewriter lately. I'm looking into bringing more people to maintain this project so I cannot give an ETA at this moment on when this will get fixed, but this is the first priority. As mentioned it is mostly due to I'll pin this and keep the thread updated when we have a clear path forward. |
Hey guys. Bumping this again. Unfortunately due to compliance reasons and dependabot vulnerabilities with the This issue where types/methods are not generated for events without properties is the biggest, a lot of our events are like this. At this point I'm close to just going and updating the tracking plan to add a dummy optional property to those events just to make typewriter generate the code. But it'd be great if I didn't have to do that as when this is eventually fixed, it would be again super cumbersome to clean things up. Another issue which blocks us is #301, where enum properties are now generated as enums, thus requiring tons of code changes which is extremely time-consuming. These 2 issues would not be such a big deal had we not had 600+ events, of which most are either without any properties, or with some properties defined as enums. So I would like to know, whether there's any chance these issues could be resolved in the near future, so I don't waste time working around them? Alternatively, what would it take to patch v7 and upgrade UPDATE: I created a branch for patching vulnerable dependencies in v7: #302 |
First of all, thank you so much for all the work that has been put on Typewriter. We're using the JS integration and also being impacted by this. Our events that have no properties never get their functions generated in the Thanks a lot! |
Thank you for adding React Native support for this library! I am starting on integrating Segment into my React Native project and am using
analytics-react-native
. I just added Typewriter v8, and it is working great, except it only generates types for events that have custom properties. Here are my observations for events that have no custom properties:rules
array inplan.json
jsonSchema.properties
is{}
as expected.segment.tsx
, there is no mention whatsoever of these events:extendedClient.myCustomEvent = () => ...
function is not created inextendSegmentClient
I've verified that if I go into Segment and add even a single property to the event and then rerun
npx typewriter -u
, or if I just manually add properties toplan.json
, the events are added tosegment.tsx
as expected.Proposed solution
Ideally, if I had an event called
My Custom Event
that takes no properties, something like the following would be generated insegment.tsx
:The second argument of
client.track
is already typed to accept undefined, so this doesn't result in any errors with the client or TypeScript.Here is my
typewriter.yml
:I'd be happy to take a pass at fixing this and opening a PR but might need a bit of help getting pointed in the right direction. Thanks again for this library! 🙂
Steps to reproduce
npx typewriter
ornpx typewriter -u
segment.tsx
Versions
The text was updated successfully, but these errors were encountered: