I cannot figure out this typing error

I cannot figure out this typing error
No description
8 Replies
DanTheGoodman
DanTheGoodmanOP16mo ago
export function CreateWorkflow<T>(options: DurableWorkflowOptions<T>): DurableObject {
// options: DurableWorkflowOptions<T>

return class DurableWorkflow<T> implements DurableObject {
state: DurableObjectState
alarmStack: AlarmStack

constructor(state: DurableObjectState) {
this.state = state
this.alarmStack = new AlarmStack(this.state)
}

async fetch(request: Request) {
return new Response("unknown path", {
status: 404
})
}

async alarm() {}
}
}
export function CreateWorkflow<T>(options: DurableWorkflowOptions<T>): DurableObject {
// options: DurableWorkflowOptions<T>

return class DurableWorkflow<T> implements DurableObject {
state: DurableObjectState
alarmStack: AlarmStack

constructor(state: DurableObjectState) {
this.state = state
this.alarmStack = new AlarmStack(this.state)
}

async fetch(request: Request) {
return new Response("unknown path", {
status: 404
})
}

async alarm() {}
}
}
I've got up to date types
DanTheGoodman
DanTheGoodmanOP16mo ago
it does have those things though...
No description
DanTheGoodman
DanTheGoodmanOP16mo ago
if I remove the implements, it says it doesn't have the method
No description
DanTheGoodman
DanTheGoodmanOP16mo ago
if I let it autofill that it does
fetch(request: Request<unknown, CfProperties<unknown>>): Response | Promise<Response> {

}
fetch(request: Request<unknown, CfProperties<unknown>>): Response | Promise<Response> {

}
DanTheGoodman
DanTheGoodmanOP16mo ago
ugh
No description
DanTheGoodman
DanTheGoodmanOP16mo ago
I removed the : DurableObject from the top level function and it seems to work fine now
Isaac McFadyen
Isaac McFadyen16mo ago
Try importing Request from workers-types too. Looks like you're trying to use the built-in Request which is different from the Workers Request.
DanTheGoodman
DanTheGoodmanOP16mo ago
Did that, got a different error That was actually missing the methods
Want results from more Discord servers?
Add your server