Git Product home page Git Product logo

Comments (4)

tdonohue avatar tdonohue commented on May 29, 2024

This discussion came up in today's meeting and is in reference to the already merged PR #61 (which uses cerialize)

from dspace-angular.

artlowel avatar artlowel commented on May 29, 2024

Type assertion alone wont do, because that only helps at compile time. If you assert a plain javascript object is a Collection for example, it won't get any of Collection's methods, because that assertion is compiled out, javascript doesn't know about it. You need to create a new Collection instance, and give it the properties of that plain javascript object, in order to be able to use Collection's methods on it. A serialization lib helps with that.

I compared class-transformer and cerialize when I was writing the hal-serializer, and both libs are quite similar. I ended up choosing cerialize mainly because i thought their naming was clearer, and because class-transformer had issues with arrays and dates not serializing under certain circumsances, that had been open, without response for quite some time.

If you have good reason to prefer class-transformer I'm willing to reconsider.

from dspace-angular.

 avatar commented on May 29, 2024

I suppose it would be a lot to ask for type assertion to transpile into a javascript object that can deserialize complex json. I could imagine how it could though. I did not do any research into the different options, I just found them passing in other articles and notice class-tranformer is a more popular library.

from dspace-angular.

artlowel avatar artlowel commented on May 29, 2024

closing

from dspace-angular.

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.