Skip to content

Commit 8dc62e1

Browse files
authored
fix: parse example CLI flag --chain as number (#545)
1 parent 773551b commit 8dc62e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/cli/src/flags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const possibleChains = [314159, 314] as const
22
type Chains = (typeof possibleChains)[number]
33

4-
const Chain = (chain: Chains) => {
4+
const Chain = (chainStr: string) => {
5+
const chain = Number(chainStr) as Chains
56
if (!possibleChains.includes(chain)) {
67
throw new Error(
78
`Invalid chain: ${chain}. Must be one of: ${possibleChains.join(', ')}`

0 commit comments

Comments
 (0)