question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No type info without type option

See original GitHub issue

The simple @JsonMember doesn’t work, I have error "No valid 'type' option was specified for 'DatabaseConfig.password'". I have to use:

@JsonMember({ type: String })
firstName: string;

In my package.json:

"dependencies": {
    "reflect-helper": "^1.0.2",
    "reflect-metadata": "^0.1.8",
  },

In my tsconfig.json:

"compilerOptions": {
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
}

What else I have to do to make it work like in sample?

@JsonObject
class Person {
    @JsonMember
    firstName: string;

    @JsonMember
    lastName: string;

    public getFullname() {
        return this.firstName + " " + this.lastName;
    }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MichalLytekcommented, Sep 16, 2016

Why the node_modules instalation doesn’t work? I have even typescript compiler running from it to be able to deploy app easy - all dependencies are defined in package.json so npm install and go.

0reactions
MichalLytekcommented, Oct 20, 2017

All we need to do is to place import "reflect-metadata"; on top of the entry file 😉

Closing this issue because now I use class-transformer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Cast object without any more info than its System.Type
The problem here is that PropertyInfo.GetValue returns an object, subsequently T will equal object in the recursive call and i can no longer...
Read more >
typing — Support for type hints — Python 3.11.1 documentation
A user-defined generic class can have ABCs as base classes without a metaclass conflict. Generic metaclasses are not supported. The outcome of parameterizing ......
Read more >
Documentation - Everyday Types - TypeScript
Everyday Types. In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the...
Read more >
Anonymous Types | Microsoft Learn
The type of each property is inferred by the compiler. You create anonymous types by using the new operator together with an object...
Read more >
Custom Implementation of the Option/Maybe Type in C#
Optional object is characterized by the fact that it might exist or might not exist. There is no null, no other notion but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found