Skip to content

targetUserId type doesn't allow null #23

@wuservices

Description

@wuservices

See

* @param targetUserId - ID of the user who will see the recommendations.
* Specifying the *targetUserId* is beneficial because:
* * It makes the recommendations personalized
* * Allows the calculation of Actions and Conversions
* in the graphical user interface,
* as Recombee can pair the user who got recommendations
* and who afterward viewed/purchased an item.
* If you insist on not specifying the user, pass `null`
* (`None`, `nil`, `NULL` etc., depending on the language) to *targetUserId*.
* Do not create some special dummy user for getting recommendations,
* as it could mislead the recommendation models,
* and result in wrong recommendations.
* For anonymous/unregistered users, it is possible to use, for example, their session ID.
* @param count - Number of items to be recommended (N for the top-N recommendation).
* @param optional - Optional parameters given as an object.
*/
constructor(
itemId: string,
targetUserId: string,

The docs align with the API docs on your site's API reference, and mention passing null, however the type only allows string. Based on the docs, it seems like string | null should be the type. I'm casting in my own code.

Note

I only referenced on occurrence, but this is a repeated issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions