Skip to content

Commit 18604ea

Browse files
committed
combobox values can't be numbers
1 parent 9c8f2dc commit 18604ea

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

app/forms/firewall-rules-common.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ const availableItems = (
260260
// Protocol selection form values for the subform
261261
type ProtocolFormValues = {
262262
protocolType: VpcFirewallRuleProtocol['type'] | ''
263-
icmpType?: number | string // ComboboxField with allowArbitraryValues can return strings
263+
icmpType?: string // ComboboxField with allowArbitraryValues can return strings
264264
icmpCode?: string
265265
}
266266

@@ -356,11 +356,9 @@ const isDuplicateProtocol = (
356356

357357
type ParseResult<T> = { success: true; data: T } | { success: false; message: string }
358358

359-
const parseIcmpType = (
360-
value: string | number | undefined
361-
): ParseResult<number | undefined> => {
359+
const parseIcmpType = (value: string | undefined): ParseResult<number | undefined> => {
362360
if (value === undefined || value === '') return { success: true, data: undefined }
363-
const parsed = typeof value === 'string' ? parseInt(value, 10) : value
361+
const parsed = parseInt(value, 10)
364362
if (isNaN(parsed) || parsed < 0 || parsed > 255) {
365363
return { success: false, message: `ICMP type must be a number between 0 and 255` }
366364
}

0 commit comments

Comments
 (0)