#Boolean query param is parsed in development but not in production??

7 messages · Page 1 of 1 (latest)

dark lava
#

Hello, I already fixed this issue, but I still don't understand what's going on.

I have a boolean query param like this:

@Query('checked') checked: boolean

There is no ParseBoolPipe yet, but this works while in development (npm run start:dev). I get a boolean with console.log(typeof checked).

Now, as a developer I see this and push it to production, where it breaks. In production the console.log shows string.

Why? I fixed it by adding a new ParseBoolPipe() but I don't understand why the difference in behaviour without a warning.

atomic nebula
#

just having that
@Query('checked') checked: boolean
isn't enough to parse query parameters

#

you must use ParseBoolPipe or something like that

dark lava
#

hi, but it works in development, that's what I don't understand

#

without the pipe it actually works

#

but running npm run start:prod the result is different:

#

I can only think that the development server is doing something aditional