Skip to content

fix: @IsBoolean always transforms the value of a boolean query param to true #2170

Closed as not planned
typestack/class-transformer
#1686
@SLSJL

Description

@SLSJL

Description

@IsBoolean alway transforms the value of a boolean query param to true
even if the transformOptions.enableImplicitConversion.true is set as true

Definition of a boolean query parameter is as below.

Minimal code-snippet showcasing the problem

  @IsBoolean()
  @IsOptional()
  @Transform((object) => {
    console.log(object);
    return object.value;
  })
  isMuted?: boolean;

Expected behavior

// For query param value as  'true'
{
value: true,
key: 'isMuted',
object: {isMuted: 'true', ...}
...
}
{
value: false,
key: 'isMuted',
object: {isMuted: 'fale', ...}
...
}

Actual behavior

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions