Skip to content

Commit b10179e

Browse files
committed
chore: update according to comments
1 parent d832869 commit b10179e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/shared/src/utils/phone.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ function validateE164Number(value: string): asserts value is E164Number {
1010
}
1111

1212
const parseE164Number = (value: string): E164Number | '' => {
13-
// If typeof `value` is string and `!value` is true, then `value` is an empty string.
1413
if (!value) {
15-
return '';
14+
/**
15+
* 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 '';
1620
}
1721

1822
const result = value.startsWith('+') ? value : `+${value}`;

0 commit comments

Comments
 (0)