No type info without type option
See original GitHub issueThe 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:
- Created 7 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 inpackage.json
so npm install and go.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.