Typescript noob question

Hooboy i have a typescript noob question... I have a function that returns an array of either {ok: true} or {ok: false, error: "message"} items how would you describe the return type?
1 Reply
fotoflo
fotofloOP2y ago
maybe i should make error: null if ok is true... ... then type BatchResponse = { ok: boolean; error: string | null; }[]; works!
Want results from more Discord servers?
Add your server