knocklabs / knock-node

Official Node SDK for interacting with the Knock API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

set object optional properties?

naquarius opened this issue · comments

commented

Hello! I'm trying to set an object like this

    const setObjectResult = await knock.objects.set(
      collection,
      id,
      metadata
    );

per documentation here https://docs.knock.app/reference#set-object
where metadata is an optional object, however i'm getting a typescript error

Argument of type 'Object | undefined' is not assignable to parameter of type 'SetObjectProperties'.
  Type 'undefined' is not assignable to type 'SetObjectProperties'.ts(2345)
(parameter) metadata: Object | undefined

is this intentional? should i pass in an empty object instead of undefined?

edit: my goal is to create a new object that identify a group of users to send in-app notification to, assuming the steps are: 1) create object, 2)add users to subscriptions, 3) trigger workflow by sending in subscription group (object?) id