dizyann's picture
feat: expose typed decide brick and terminal CLI
3f7a9b2
Raw History Blame Contribute Delete
386 Bytes
import { decide } from '../../src/index.js'
import { input } from './input.js'
const result = await decide(input)
.onSuccess((answers) => ({ ok: true as const, answers }))
.onError({ type: 'invalid-input' }, (error) => ({ ok: false as const, error }))
.onError({ type: 'input-too-long' }, (error) => ({ ok: false as const, error }))
console.log(JSON.stringify(result, null, 2))