Closed bogeychan closed 1 month ago
Should have been fixed with 69eb72a, published under 1.1.2
@SaltyAom, yes, it fixed it but there's a follow up error:
import { Elysia } from "elysia";
export const logger = new Elysia({ name: "logger" }).derive(
{ as: "global" },
() => ({
logger: {
log(msg: string) {
console.log(msg);
},
},
})
);
export const error = new Elysia({ name: "error" })
.use(logger)
.error({
Error,
})
.onError({ as: "global" }, (ctx) => {
ctx.logger.log(ctx.code);
// ^ Property 'logger' does not exist on type ...
});
new Elysia()
.use(error)
.get("/", () => {
throw new Error("whelp");
})
.listen(8080);
The logger
exists at runtime but type error as shown in comment.
Open http://localhost:8080/ in browser
Should have been fixed with https://github.com/elysiajs/elysia/commit/20431a290e1a1339a380253e3c10a068f4a131b1, published under 1.1.3
Thanks, works for me
What version of Elysia.JS is running?
1.1.0
What platform is your computer?
WSL Ubuntu
What steps can reproduce the bug?
What is the expected behavior?
no type error
What do you see instead?
type error (see comment)
Additional information
Everything besides
global
works fine.reported on discord