Closed skorfmann closed 7 months ago
Looks a bit similar to https://github.com/winglang/wing/issues/3717 but this might be a coincidence
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
The example in the original issue compiles and works now.
However, the alternate case where you write the code as a static method (instead of a free-floating function) causes a runtime error:
bring cloud;
class A {
pub static authenticatedMiddleware(handler: inflight (cloud.ApiRequest): cloud.ApiResponse): inflight (cloud.ApiRequest): cloud.ApiResponse {
let middleware = inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
return handler(req);
};
return middleware;
}
}
let api = new cloud.Api();
api.get("/hello", A.authenticatedMiddleware(inflight (req) => {
return { status: 200 };
}));
However, the alternate case where you write the code as a static method (instead of a free-floating function) causes a runtime error...
Fixed in #6040, closing.
I tried this:
see playground
This happened:
I expected this:
no error
Is there a workaround?
No response
Anything else?
Perhaps related to this, but I'm not sure https://github.com/winglang/wing/pull/4993
Wing Version
0.50.6
Node.js Version
18.7
Platform(s)
MacOS
Community Notes