Skip to content

Commit

Permalink
feat(core): compatibility with new versions of class-transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
Matii96 committed Dec 22, 2022
1 parent 957330c commit 689e26b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/lib/loader/loader.impl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { plainToClass } from 'class-transformer';
import { plainToInstance, plainToClass } from 'class-transformer';
import { ClassConstructor } from '../utils/class-constructor.interface';
import { ConfigSource, ConfigSourceEntry } from '../adapters/adapter';
import { mappedPropertyKey, PROPERTIES_MAPPING_METADATA, PROPERTIES_NESTING_METADATA } from './constants';
Expand All @@ -8,7 +8,7 @@ import { Loader } from './loader';
export class ConfigLoader implements Loader {
load<TTemplate>(template: ClassConstructor<TTemplate>, source: ConfigSource) {
const plain = this.formatObject(template, source, source);
return plainToClass(template, plain, { enableImplicitConversion: true });
return (plainToInstance ?? plainToClass)(template, plain, { enableImplicitConversion: true });
}

private formatObject(template: ClassConstructor, skeleton: ConfigSource, source: ConfigSource) {
Expand Down

0 comments on commit 689e26b

Please sign in to comment.