mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore: update according to comments
This commit is contained in:
parent
6cc51d098b
commit
1ed8c0a029
1 changed files with 6 additions and 2 deletions
|
@ -10,9 +10,13 @@ function validateE164Number(value: string): asserts value is E164Number {
|
|||
}
|
||||
|
||||
const parseE164Number = (value: string): E164Number | '' => {
|
||||
// If typeof `value` is string and `!value` is true, then `value` is an empty string.
|
||||
if (!value) {
|
||||
return '';
|
||||
/**
|
||||
* The type inference engine can not properly infer the type of the empty string,
|
||||
* but using `string` instead. So we need to cast it.
|
||||
*/
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
return value as '';
|
||||
}
|
||||
|
||||
const result = value.startsWith('+') ? value : `+${value}`;
|
||||
|
|
Loading…
Reference in a new issue