Skip to main content

Using dot notation in property names will create interfaces with nested properties, but the nested enums will not be typed correctly.

For example, for event with the following properties:

enum → enum u“foo”, “bar”]
nested.string → string
nested.number → number
nested.enum → enum s“foo”, “bar”]

Ampli will generate a following interface:

interface EventProperties{
enum: "foo" | "bar";
nested: {
string: string;
number?: number;
enum: {
bk: string]: any;
};
};
}

Other notes:

  • The documentation on property types is missing or outdated
  • There’s no public repository for Ampli where issue like this or pull request could be created
  • Is community forums really the best solution for reporting technical issues?

Hi @Viktor ,

 

Thanks for writing in! Can you elaborate on what you expected the enum to look like? Can you also expand on why you are trying to use nested properties? I believe this would actually be the expected behaviour but can you show me the raw data you sent in and how you expected it to look? 

  • The documentation on property types is missing or outdated
    Can you link me the documentation and specify what exactly is missing?
  • There’s no public repository for Ampli where issue like this or pull request could be created
    We do have this repository here for Typescript here where you can submit issues. 
  • Is community forums really the best solution for reporting technical issues?
    Yes, if you are on the free plan, this is the best option and allows for others to see it too. 

I hope this helps for now, I look forward to your reply. 

 

Kind Regards,
Denis

 


Can you elaborate on what you expected the enum to look like?

Reposting my example with comments:

interface EventProperties{
enum: "foo" | "bar"; // unnested enum is typed correctly
nested: {
string: string; // nested string as expected
number?: number; // nested number as expected
enum: {
[k: string]: any;
}; // nested enum has incorrect type
};
}

Can you also expand on why you are trying to use nested properties? I believe this would actually be the expected behaviour but can you show me the raw data you sent in and how you expected it to look?

Using dot notation because it’s a clear method for namespacing properties that can have overlapping names because of relational data models. All the tooling I’ve used so far like Ampli and Amplitude Node.js SDK treat dot notation as nested objects and support it just fine when sending nested data. The only issue is that the autogenerated types are wrong for enums while other nested properties get typed correctly.


Hi @Viktor ,

 

I am currently consulting internally on this, I will get back to you as soon as I have an update. Thank you for your patience.

 

Kind Regards,
Denis


Hi @Viktor ,

 

Apologies, posted the wrong message first! I do want to let you know we are looking into this currently. 

 

Kind Regards,
Denis


Hi @Viktor ,

 

This should be resolved now, would you be so kind as to check for me? Thank you!

 

Kind Regards,
Denis


Hi @Viktor ,

 

This should be resolved now, would you be so kind as to check for me? Thank you!

 

Kind Regards,
Denis

Looks like it’s fixed now, thanks!


Reply