Giter Site home page Giter Site logo

kmathy / cerializr Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 0.0 662 KB

Serialization with decorators

License: MIT License

TypeScript 99.39% JavaScript 0.61%
annotations cerializr decorators deserialize javascript json serialization serialize serializing-data typescript

cerializr's People

Contributors

1ambda avatar antitoine avatar buonjg avatar ceymard avatar christophercr avatar kmathy avatar marcelhoogesteger avatar prudnikov avatar rodolfosilva avatar thebinaryfox avatar weichx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cerializr's Issues

Uncaught TypeError: Object(...) is not a function

Hi,

first of all thanks for providing this library, which I think is a really nice object-oriented based alternative to the functional style of mapping observable responses in order to map api responses.

Unfortunately I encountered a problem with the latest version when using it with the angular cli prod build. See my sample at exaptis/nx-cerializr@15b619d

  1. run ng build --prod or npm run build -- --prod
  2. serve the dist build http-server dist/apps/cerializr -o
  3. in the console the error Uncaught TypeError: Object(...) is not a function at main-es2015... is shown.

Screenshot 2019-12-26 at 13 08 43

It only works if you skip the --prod step, as this will optimize and minify the bundle, but then the bundle is not suitable for production.

It works in prod mode if I switch back to 3.0.3 before the webpack build was introduced. Can you have a look at this please, that would be great!

Thanks and happy holidays!
David

TypeError: Object(...) is not a function

Quite probably a missed step on my part, but can't get past this error.

import { autoserializeAs, serializeAs, deserializeAs } from 'cerializr';
export class Starship {
    @serializeAs(String)
    @deserializeAs(Number)
    remainingFuel : number;
}
  public testJSON() {
    let test = {
      remainingFuel: 500.5,
    }
    return Deserialize(test, Starship);
  }

"experimentalDecorators": true,

Gives me a TypeError: Object(...) is not a function error against the @serializeAs(String) line in Starship. Is there anything specific to get it to recognize the decorators??

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.