Skip to content

Commit

Permalink
Unbreak default ints in text input (#5118)
Browse files Browse the repository at this point in the history
* Unbreak default ints in text input

* add a comment explaining this

* the ternary is not needed

* add release note

* format:other
  • Loading branch information
Berlioz committed Oct 13, 2022
1 parent 200ee7e commit 12a8887
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -0,0 +1 @@
- Fixes a crash in integer params when a default value is selected in the prompt. (#5118)
5 changes: 4 additions & 1 deletion src/deploy/functions/params.ts
Expand Up @@ -605,7 +605,10 @@ async function promptText<T extends RawParamValue>(
return promptText<T>(prompt, input, resolvedDefault, converter);
}
}
const converted = converter(res);
// TODO(vsfan): the toString() is because PromptOnce()'s return type of string
// is wrong--it will return the type of the default if selected. Remove this
// hack once we fix the prompt.ts metaprogramming.
const converted = converter(res.toString());
if (typeof converted === "object") {
logger.error(converted.message);
return promptText<T>(prompt, input, resolvedDefault, converter);
Expand Down

0 comments on commit 12a8887

Please sign in to comment.