Mapping generics #357
-
Maybe I just don't get the syntax (hopefully ;)), but currently I have to do something like:
But is it possible to do something like (inside a class where the generic types are defined, like "class X<TViewModel, TDto>"):
(edit: I'm using profiles to define the mappings) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
you can't use it like that because See https://github.com/microsoft/TypeScript/wiki/FAQ#what-is-type-erasure |
Beta Was this translation helpful? Give feedback.
you can't use it like that because
<TViewModel, TDto>
is just typing stuff that cannot be read at compile nor at run time (generally speaking), thus you need to tell to AutoMapper what are the source and destination classesSee https://github.com/microsoft/TypeScript/wiki/FAQ#what-is-type-erasure