Skip to content

Type Mismatch in User interface for Datadog Tracer #3707

@paw-j

Description

@paw-j

Expected behaviour

The setUser method in the Datadog Tracer library should accept user attributes of various types including number, boolean, and Date, as evident from actual usage and logs.

image

While this exact payload it's completely valid if bypassed by @ts-ignore, type casting or any other method.

image

Actual behaviour

The TypeScript definition for the User interface restricts attributes to be of type string. This is inconsistent with actual behavior and leads to unnecessary type errors during development.

Steps to reproduce

Try using the setUser method with user attributes that are not of type string.

tracer.setUser({
  id: 1, // number
  email: "test@email.com", // string
  createdAt: new Date(), // Date object
  isEnabled: true, // boolean
});
// TypeScript will throw a type error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions