FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(@angular-devkit/schematics-cli): Add boolean type inference for 'true' and 'false' string values in argument parsing by alan-agius4 · Pull Request #32362 · angular/angular-cli · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 10 additions & 3 deletions packages/angular_devkit/architect/bin/architect.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,16 @@ function parseOptions(args: string[]): Options {
}
}

// Type inference for numbers
if (typeof value === 'string' && !isNaN(Number(value))) {
value = Number(value);
if (typeof value === 'string') {
if (!isNaN(Number(value))) {
// Type inference for numbers
value = Number(value);
} else if (value === 'true') {
// Type inference for booleans
value = true;
} else if (value === 'false') {
value = false;
}
}

const camelName = strings.camelize(name);
Expand Down
13 changes: 10 additions & 3 deletions packages/angular_devkit/schematics_cli/bin/schematics.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,16 @@ function parseOptions(args: string[]): Options {
}
}

// Type inference for numbers
if (typeof value === 'string' && !isNaN(Number(value))) {
value = Number(value);
if (typeof value === 'string') {
if (!isNaN(Number(value))) {
// Type inference for numbers
value = Number(value);
} else if (value === 'true') {
// Type inference for booleans
value = true;
} else if (value === 'false') {
value = false;
}
}

const camelName = strings.camelize(name);
Expand Down

Back | FazBrowse Home | New Git URL