Where do I find type definitions for a Forge trigger function

When I create a new app as a product trigger, then I get a index.jsx that looks like:

export async function run(event, context) {
    console.log('Hello World!');
}

I can rename the index.jsx to tsx that the file is treated as Typescript file, but where do I find the definitions for èvent and context ?

1 Like

if you mean the definitions in manifest yml or index.tsx

modules:
  trigger:
    - key: comment-creation-trigger
      function: comment-create-func
      events:
        - avi:confluence:created:comment
export async function listenCommentCreate(event, context) {
    const pageID = event.content.container.id;
    const commentID = event.content.id;
    const spaceId = event.content.space.id;
 

    return {"msg": "event received"};
}

Hey @m22, we don’t have TS definitions for the event and context in code, but you can find some more detail about the payload for different product events at https://developer.atlassian.com/platform/forge/events-reference/jira/.

You could also try console.log the event and context functions and use the forge logs command to see what information there is.

1 Like