elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
10.27k stars 219 forks source link

Cookie: Right side of assignment cannot be destructured `aot: true` #750

Closed bogeychan closed 2 months ago

bogeychan commented 2 months ago

What version of Elysia.JS is running?

1.1.3

What platform is your computer?

WSL Ubuntu

What steps can reproduce the bug?

import { Elysia } from "elysia";

new Elysia()
  .get("/", ({ set, cookie: { auth } }) => {
    console.log(auth.value);
    return "";
  })
  .listen(8080);

Open http://localhost:8080/ in browser

What is the expected behavior?

no error

What do you see instead?

{"name":"TypeError","message":"Right side of assignment cannot be destructured"}

Additional information

This works as expected:

import { Elysia } from "elysia";

// order of destructured objects matter `cookie, set` !== `set, cookie`
new Elysia()
  .get("/", ({ cookie: { auth }, set }) => { 
    console.log(auth.value);
    return "";
  })
  .listen(8080);

Works with aot: false too: new Elysia({ aot: false })

reported on discord

PrashantSakre commented 2 months ago

yes getting the same issue in version 1.1.3

SaltyAom commented 2 months ago

Should have been fixed with a59edcc, published under 1.1.4

nephix commented 2 months ago

Can confirm it works 🚀 thank you @SaltyAom 🙏

bogeychan commented 2 months ago

ty, works for me too