@@ -100,26 +100,10 @@ interface AnalyticsContext {
100100 [ key : string ] : any
101101}
102102
103- // "object" is not ideal, but with JSONObject, we ran into at least one bad edge case around index sig.
103+ // This is not ideal, but it works with all the edge cases
104+ export type Traits = Record < string , any >
104105
105- /**
106- * An object literal representing traits
107- * - identify: https://segment.com/docs/connections/spec/identify/#traits
108- * - group: https://segment.com/docs/connections/spec/group/#traits
109- * @example
110- * { name: "john", age: 25 }
111- */
112- export type Traits = object & JSONObject // intersection adds an index signature
113-
114- /**
115- * An object literal representing Segment event properties
116- * - track: https://segment.com/docs/connections/spec/track/#properties
117- * - page: https://segment.com/docs/connections/spec/page/#properties
118- * - screen: https://segment.com/docs/connections/spec/screen/#properties
119- * @example
120- * { artistID: 2435325, songID: 13532532 }
121- */
122- export type EventProperties = object & JSONObject // intersection adds an index signature
106+ export type EventProperties = Record < string , any >
123107
124108export interface SegmentEvent {
125109 messageId ?: string
@@ -129,9 +113,22 @@ export interface SegmentEvent {
129113 // page specific
130114 category ?: string
131115 name ?: string
132-
116+ /**
117+ * An object literal representing Segment event properties
118+ * - track: https://segment.com/docs/connections/spec/track/#properties
119+ * - page: https://segment.com/docs/connections/spec/page/#properties
120+ * - screen: https://segment.com/docs/connections/spec/screen/#properties
121+ * @example
122+ * { artistID: 2435325, songID: 13532532 }
123+ */
133124 properties ?: EventProperties
134-
125+ /**
126+ * An object literal representing traits
127+ * - identify: https://segment.com/docs/connections/spec/identify/#traits
128+ * - group: https://segment.com/docs/connections/spec/group/#traits
129+ * @example
130+ * { name: "john", age: 25 }
131+ */
135132 traits ?: Traits
136133
137134 integrations ?: Integrations
0 commit comments