Giter VIP home page Giter VIP logo

Comments (7)

Romakita avatar Romakita commented on July 16, 2024 1

Hello @Tlahey ,

Yes, I've copy the bad decorators to do that. So v1.4.4 fix that and I remove the converter option in this case to store an object with references.

You can do that:

@Get('/')
myMethod(@Locals() obj: any);  // return the locals objects by reference
myMethod(@Locals("exp") value: any);  // return the parsed expression (by reference if it's an object)
myMethod(@Locals("exp") value: MyModel); // doesn't work's 

Sorry for this mistake :)

from tsed.

Romakita avatar Romakita commented on July 16, 2024

Hello @Tlahey ,

Yes, I can plan this decorators for the next version :)

from tsed.

Romakita avatar Romakita commented on July 16, 2024

v1.4.2 is available with the @Locals decorator :)

from tsed.

Tlahey avatar Tlahey commented on July 16, 2024

Thanks a lot ! :)

from tsed.

Tlahey avatar Tlahey commented on July 16, 2024

I'm currently using the decorator, but i think he is on the request parameter.
file "middleware.ts" line 295

In express api, the local param are bind on the response parameter.

Source :

http://expressjs.com/fr/api.html#res.locals

Edit :
I can't store an object with reference (and circulars dependances)

from tsed.

Tlahey avatar Tlahey commented on July 16, 2024

Hello @Romakita

No problem for the mistake ;)
I've try the v1.4.4 and all it's ok ! :)

Thanks for all

Edit:

myMethod(@Locals("exp") value: MyModel); // return the parsed expression (by reference if it's an object)

Work for me ! MyModel is an instance class.

from tsed.

Romakita avatar Romakita commented on July 16, 2024

Ok it's work if you already added manually a class in the locals attribute ;). In this case, the converter mechanism isn't used to convert POJ to a class instance like BodyParams.

from tsed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.