segmentio / typewriter

Type safety + intellisense for your Segment analytics
https://segment.com/docs/protocols/typewriter/
MIT License
228 stars 53 forks source link

Objective-C Typed Parameters #287

Open DreamingInBinary opened 1 year ago

DreamingInBinary commented 1 year ago

We are using Typewriter for Objective-C, which as I understand it - requires ~Typerwriter 7.x. In the docs here, it mentions that...

If you use a statically typed language (such as TypeScript, Java, Objective-C, or Swift), you get access to compile-time warnings about your instrumentation

The image below that except shows the compiler flagging a parameter supplying the wrong type (a string instead of a number).

As far as I can tell, all Objective-C parameters are generated as Strings, regardless of what data type the tracking plan dictates. Here's an example of our output, even though some of these parameters aren't string types in our plan:

+ (void)widgetAddedWithClientId:(nullable NSString *)clientId
clientName:(nonnull NSString *)clientName
organizationId:(nonnull NSString *)organizationId
widgetName:(nonnull NSString *)widgetName
widgetSize:(nullable NSString *)widgetSize;

Is there a way for Typewriter to generate strongly typed parameters according to their tracking plan counterparts data type?