Skip to content

Commit c52d494

Browse files
Merge pull request nestjs#2885 from Diluka/patch-1
fix(common) ParseIntPipe should properly handle number value
2 parents 38d1cfd + be25319 commit c52d494

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/common/pipes/parse-int.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class ParseIntPipe implements PipeTransform<string> {
2020
*/
2121
async transform(value: string, metadata: ArgumentMetadata): Promise<number> {
2222
const isNumeric =
23-
'string' === typeof value &&
23+
['string', 'number'].includes(typeof value) &&
2424
!isNaN(parseFloat(value)) &&
2525
isFinite(value as any);
2626
if (!isNumeric) {

0 commit comments

Comments
 (0)