Skip to content

Commit e7458c8

Browse files
committed
fix(@angular-devkit/schematics-cli): Add boolean type inference for 'true' and 'false' string values in argument parsing
Handles booleans correctly Closes angular#32361 (cherry picked from commit dbd81a7)
1 parent e974e40 commit e7458c8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/angular_devkit/schematics_cli/bin/schematics.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,16 @@ function parseOptions(args: string[]): Options {
518518
}
519519
}
520520

521-
// Type inference for numbers
522-
if (typeof value === 'string' && !isNaN(Number(value))) {
523-
value = Number(value);
521+
if (typeof value === 'string') {
522+
if (!isNaN(Number(value))) {
523+
// Type inference for numbers
524+
value = Number(value);
525+
} else if (value === 'true') {
526+
// Type inference for booleans
527+
value = true;
528+
} else if (value === 'false') {
529+
value = false;
530+
}
524531
}
525532

526533
const camelName = strings.camelize(name);

0 commit comments

Comments
 (0)