fix: Expose's since and until do not work when using properties with a different name
Author: gkasseCreated Aug 25, 2025Updated Aug 25, 2025
Labelstype: fixstatus: needs triage
Description
When converting objects with different names with properties using plainToInstance, version control using since/until does not work.
class Sample {
@Expose({ name: 'fizz', since: 0, until: 1 })
foo: any;
@Expose({ name: 'buzz', since: 2 })
bar: any;
}
const result = plainToInstance(Sample, { fizz: 'fizz', buzz: 'buzz' }, { version: 2 });
console.log(result);dependencies: class-transformer: 0.5.1 typescript: 4.9.5
Expected behavior
When the plainToInstance method is executed with version 2 specified, it is expected to ignore the object “fizz” and return an instance of Sample where foo is undefined.
Sample { bar: 'buzz' }Actual behavior
Sample { foo: 'fizz', bar: 'buzz' }Source: typestack/class-transformer