-
Notifications
You must be signed in to change notification settings - Fork 518
Open
Labels
type: questionQuestions about the usage of the library.Questions about the usage of the library.
Description
Description
In the previous version it was possible to access to the defaultMetadataStorage which was useful to create custom transformer.
for example :
Minimal code-snippet showcasing the problem
import { TransformOptions } from 'class-transformer';
import { defaultMetadataStorage } from 'class-transformer/storage/'; <== cannot find module anymore
export function doSplit(separator: string | RegExp = ' ') {
return (value: any) => {
return value !== undefined && value !== null
? String(value).split(separator)
: [];
};
}
export function Split(
separator: string | RegExp,
options: TransformOptions = {},
): PropertyDecorator {
const transformFn = doSplit(separator);
return function (target: any, propertyName: string | symbol): void {
defaultMetadataStorage.addTransformMetadata({
target: target.constructor,
propertyName: propertyName as string,
transformFn,
options,
});
};
}
Expected behavior
Get the defaultMetadataStorage !
Actual behavior
"Cannot find module 'class-transformer/storage' or its corresponding type declarations."
tmtron, igoreso, tajnymag, PhilippMolitor, TheRealKoeDev and 31 morejadigar and lc-brito
Metadata
Metadata
Assignees
Labels
type: questionQuestions about the usage of the library.Questions about the usage of the library.