I'm using TypeScript to write some Cloud Functions (Gen 2) in GCP that are triggered by a PubSub message. Right now my code looks like this:
import { CloudEvent, cloudEvent } from "@google-cloud/functions-framework"
interface PubsubMessageSentData {
message: {
data: string
}
}
cloudEvent("test", async (cloudEvent: CloudEvent<PubsubMessageSentData>) => {
console.log("Data:", cloudEvent.data?.messgae.data)
})
I'm wondering if there's a type like PubsubMessageSentData
defined by google somehwere so I don't have to rely on the interface I've written myself.
I'd expect there to be a type I can use to easily use as a type argument for CloudEvent<>
I've found the types I'm looking for -