Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SLSJL opened this issue Jul 21, 2023 · 2 comments · May be fixed by typestack/class-transformer#1686
Closed
Labels
status: wontfix type: fix Issues describing a broken feature.

Comments

@SLSJL
Copy link

SLSJL commented Jul 21, 2023

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
@SLSJL SLSJL added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Jul 21, 2023
@NoNameProvided NoNameProvided added status: wontfix and removed status: needs triage Issues which needs to be reproduced to be verified report. labels May 4, 2024
@NoNameProvided
Copy link
Member

This works as expected. Any non-empty string value is transformed to boolean true by Javascript.

Closing as wontfix.

@NoNameProvided NoNameProvided closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
@NoNameProvided NoNameProvided changed the title fix: @IsBoolean alway transforms the value of a boolean query param to true` fix: @IsBoolean always transforms the value of a boolean query param to true May 4, 2024
Copy link

github-actions bot commented Jun 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: wontfix type: fix Issues describing a broken feature.
Development

Successfully merging a pull request may close this issue.

2 participants