lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.58k stars 504 forks source link

boolean | null auto translates to false ? #1720

Open JimmyBjorklund opened 2 hours ago

JimmyBjorklund commented 2 hours ago

Hi Have an update request that looks like this

interface UpdateRequest {
  u: boolean | null
}

@Put("g/{id}")
async updateU(id: string, @Body() body: UpdateRequest ): Promise<void> {
   console.log("update", body);
}

When trying to pass null to the variable u it auto translates to false instead of null that one would expect. Is this expected? /Jimmy

JimmyBjorklund commented 1 hour ago

Found another strang thing if i set u: "null" | boolean; Then passing both null and "null" seems to work, this seams wrong if i set a string "null" then null should not work ?