Skip to content

feature: Improve Transform type #1817

Open
@karlismelderis-mckinsey

Description

Description

Please use unknown instead of any in Transform function params
It saved us from a lot of bug

this is an override that worked for us

declare module 'class-transformer' {
  export declare function Transform(
    transformFn: (params: {
      /**
       * there are edge cases where value is undefined hence it's better to always use `obj[key]`
       */
      value: never;
      key: string;
      obj: Record<string, unknown>;
      type: TransformationType;
      options: ClassTransformOptions;
    }) => unknown,
    options?: TransformOptions,
  ): PropertyDecorator;
}

Proposed solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: needs discussionIssues which needs discussion before implementation.type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions