Skip to content

Commit

Permalink
docs: add information about strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 31, 2021
1 parent 0ae6844 commit 90d61e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs-site/docs/mapping-configuration/map-defer.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ mapper.createMap(User, UserDto).forMember(
```

`mapDefer()` will set the `TransformationType` to `TransformationType.MapDefer`

If you have `strict` mode turned on, you might need to annotate the generics of the `MemberMapFunction` like `convertUsing<User, string>()`
17 changes: 17 additions & 0 deletions docs-site/docs/plugins-system/classes-limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,20 @@ mapper.createMap(SomePersonDto, Person).forMember(
)
);
```

## Strict Mode

If you have `strict` mode turned on, and you have **Union Type** on your properties like: `string | null`, `number | null`, or `boolean | null`; you need to pass the `typeFn` to `@AutoMap()` like the following:

```ts
export class User {
@AutoMap(() => String)
name!: string | null;
@AutoMap(() => Number)
age!: number | null;
@AutoMap(() => Boolean)
isAdmin!: boolean | null;
}
```

This is due to **Weak Reflection** when `strict` mode is enabled.

0 comments on commit 90d61e4

Please sign in to comment.