We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d832869 commit b10179eCopy full SHA for b10179e
packages/shared/src/utils/phone.ts
@@ -10,9 +10,13 @@ function validateE164Number(value: string): asserts value is E164Number {
10
}
11
12
const parseE164Number = (value: string): E164Number | '' => {
13
- // If typeof `value` is string and `!value` is true, then `value` is an empty string.
14
if (!value) {
15
- return '';
+ /**
+ * The type inference engine can not properly infer the type of the empty string,
16
+ * but using `string` instead. So we need to cast it.
17
+ */
18
+ // eslint-disable-next-line no-restricted-syntax
19
+ return value as '';
20
21
22
const result = value.startsWith('+') ? value : `+${value}`;
0 commit comments