You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Elysia}from"elysia";newElysia().derive({as: "global"},()=>({logger: {log(msg: string){},},})).onError((ctx)=>{ctx.logger?.log("yay");// ^ Property 'logger' does not exist on type ...});
@SaltyAom, yes, it fixed it but there's a follow up error:
import{Elysia}from"elysia";exportconstlogger=newElysia({name: "logger"}).derive({as: "global"},()=>({logger: {log(msg: string){console.log(msg);},},}));exportconsterror=newElysia({name: "error"}).use(logger).error({
Error,}).onError({as: "global"},(ctx)=>{ctx.logger.log(ctx.code);// ^ Property 'logger' does not exist on type ...});newElysia().use(error).get("/",()=>{thrownewError("whelp");}).listen(8080);
The logger exists at runtime but type error as shown in comment.
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
The text was updated successfully, but these errors were encountered: