@@ -32,7 +32,7 @@ export interface CoreOptions {
3232 context ?: CoreExtraContext
3333 anonymousId ?: string
3434 userId ?: string
35- traits ?: CoreUserTraits
35+ traits ?: Traits
3636 // ugh, this is ugly, but we allow literally any property to be passed to options (which get spread onto the event)
3737 // we may want to remove this...
3838 [ key : string ] : any
@@ -142,7 +142,7 @@ export interface CoreExtraContext {
142142 * but also associate information from a previous identify call.
143143 * You should fill this object the same way you would fill traits in an identify call.
144144 */
145- traits ?: CoreUserTraits
145+ traits ?: Traits
146146
147147 /**
148148 * Dictionary of information about the campaign that resulted in the API call, containing name, source, medium, term, content, and any other custom UTM parameter.
@@ -187,7 +187,7 @@ export interface CoreSegmentEvent {
187187
188188 properties ?: EventProperties
189189
190- traits ?: CoreTraits // Traits is only defined in 'identify' and 'group', even if it can be passed in other calls.
190+ traits ?: Traits // Traits is only defined in 'identify' and 'group', even if it can be passed in other calls.
191191
192192 integrations ?: Integrations
193193 context ?: CoreExtraContext
@@ -257,30 +257,30 @@ type PhoneNumber = string | number // TODO: the docs say this can only be a stri
257257 * This interface represents reserved traits that Segment has standardized.
258258 * @link https://segment.com/docs/connections/spec/group/#traits
259259 */
260- type BaseCoreGroupTraits = DeepNullable < {
260+ type BaseGroupTraits = DeepNullable < {
261261 /**
262262 * Street address of a group.
263263 */
264- address ?: BaseCoreUserTraits [ 'address' ]
264+ address ?: BaseUserTraits [ 'address' ]
265265
266266 /**
267267 * URL to an avatar image for the group.
268268 */
269- avatar ?: BaseCoreUserTraits [ 'avatar' ]
269+ avatar ?: BaseUserTraits [ 'avatar' ]
270270
271271 /**
272272 * Date the group's account was first created. Segment recommends ISO-8601 date strings.
273273 */
274- createdAt ?: BaseCoreUserTraits [ 'createdAt' ]
274+ createdAt ?: BaseUserTraits [ 'createdAt' ]
275275
276276 /**
277277 * Description of a group
278278 */
279- description ?: BaseCoreUserTraits [ 'description' ]
279+ description ?: BaseUserTraits [ 'description' ]
280280 /**
281281 * Email address of group.
282282 */
283- email ?: BaseCoreUserTraits [ 'email' ]
283+ email ?: BaseUserTraits [ 'email' ]
284284 /**
285285 * Number of employees of a group, typically used for companies.
286286 */
@@ -289,40 +289,40 @@ type BaseCoreGroupTraits = DeepNullable<{
289289 /**
290290 * Unique ID in your database for a group.
291291 */
292- id ?: BaseCoreUserTraits [ 'id' ]
292+ id ?: BaseUserTraits [ 'id' ]
293293
294294 /**
295295 * Industry a group is part of.
296296 */
297- industry ?: BaseCoreUserTraits [ 'industry' ]
297+ industry ?: BaseUserTraits [ 'industry' ]
298298
299299 /**
300300 * Name of a group.
301301 */
302- name ?: BaseCoreUserTraits [ 'name' ]
302+ name ?: BaseUserTraits [ 'name' ]
303303
304304 /**
305305 * Phone number of a group
306306 */
307- phone ?: BaseCoreUserTraits [ 'phone' ]
307+ phone ?: BaseUserTraits [ 'phone' ]
308308
309309 /**
310310 * Website of a group.
311311 */
312- website ?: BaseCoreUserTraits [ 'website' ]
312+ website ?: BaseUserTraits [ 'website' ]
313313
314314 /**
315315 * Plan that a group is in.
316316 */
317- plan ?: BaseCoreUserTraits [ 'plan' ]
317+ plan ?: BaseUserTraits [ 'plan' ]
318318} >
319319
320320/**
321321 * Traits are pieces of information you know about a user.
322322 * This interface represents reserved traits that Segment has standardized.
323323 * @link https://segment.com/docs/connections/spec/identify/#traits
324324 */
325- type BaseCoreUserTraits = DeepNullable < {
325+ type BaseUserTraits = DeepNullable < {
326326 /**
327327 * Unique ID in your database for a user
328328 */
@@ -400,9 +400,9 @@ type BaseCoreUserTraits = DeepNullable<{
400400 company ?: {
401401 name ?: string
402402 id ?: DbId
403- industry ?: BaseCoreUserTraits [ 'industry' ]
403+ industry ?: BaseUserTraits [ 'industry' ]
404404 employee_count ?: number
405- plan ?: BaseCoreUserTraits [ 'plan' ]
405+ plan ?: BaseUserTraits [ 'plan' ]
406406 }
407407
408408 /**
@@ -438,7 +438,7 @@ type BaseCoreUserTraits = DeepNullable<{
438438 * This interface represents reserved traits that Segment has standardized.
439439 * @link https://segment.com/docs/connections/spec/group/#traits
440440 */
441- export type CoreGroupTraits = BaseCoreGroupTraits & {
441+ export type GroupTraits = BaseGroupTraits & {
442442 [ customTrait : string ] : any
443443}
444444
@@ -447,8 +447,11 @@ export type CoreGroupTraits = BaseCoreGroupTraits & {
447447 * This interface represents reserved traits that Segment has standardized.
448448 * @link https://segment.com/docs/connections/spec/identify/#traits
449449 */
450- export type CoreUserTraits = BaseCoreUserTraits & {
450+ export type UserTraits = BaseUserTraits & {
451451 [ customTrait : string ] : any
452452}
453453
454- export type CoreTraits = CoreUserTraits & CoreGroupTraits
454+ /**
455+ * Traits are pieces of information you know about a user or group.
456+ */
457+ export type Traits = UserTraits | GroupTraits
0 commit comments