#Filter hook: type Filter handler

2 messages · Page 1 of 1 (latest)

naive ibex
#

Hi everyone,

is there a way to properly type the payload Item of a filter hook?

Something like:

filter('myCollection.items.create', async (payload: MyCollection, meta, context) => {
  // some stuff
});

Unfortunately this throes an error, as the payload is typed as unknown by default.

Is there any solution that allows us to define the type? Would make developing TS extensions much easier 😅

lime gobletBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)