Closed Grmiade closed 7 years ago
Part of a WIP Pull request: https://github.com/graphcool/graphcool-lib/pull/9/commits/89322a6629fd8304552700bba881657d17451f0f
It has been released in 0.1.0
: https://github.com/graphcool/graphcool-lib/releases/tag/v0.1.0 🙂
Note that you need to specify the generic parameter for the event data:
export default async (event: FunctionEvent<any>) => {
await new Promise(r => setTimeout(r, 50))
return {
data: {
message: `Hello ${event.data.name || 'World'}`
}
}
}
or
interface EventData {
name: string
}
export default async (event: FunctionEvent<EventData>) => {
await new Promise(r => setTimeout(r, 50))
return {
data: {
message: `Hello ${event.data.name || 'World'}`
}
}
}
It would be great to export the FunctionEvent type in the definition file. To use it to type
event
parameter.