New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializing of Map with any type not working #242

BrandiATMuhkuh opened this Issue Jul 26, 2018 · 0 comments


None yet
1 participant

BrandiATMuhkuh commented Jul 26, 2018

It seems like a Map MUST have the @type decorator otherwise it does not deserialize it at all. However, when using default types, eg. any/string/... this is not possible.

For example, de-serializing myMap: Map<string, any> = new Map(); is not possible. And writing

@Type(() => any)
myMap: Map<string, any> = new Map();`

does not work either because the compiler does not know what todo with any.

I found a workaround by creating a class that acts like any

class ActLikeAny{
    [P: string]: any;

then I can write

@Type(() => ActLikeAny)
myMap: Map<string, ActLikeAny> = new Map();`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment