Effect CommunityEC
Effect Community3y ago
5 replies
Stephen Bluck

Implementing listToTree function with Effect library in TypeScript

@Effect Bot how would I implement the listToTree function with the Effect typescripy library using fuctional programming?

type Deck = {
  readonly deck_id: number;
  readonly depth: number;
  readonly parent_deck_id: O.Option<number>;
  readonly logo_url: O.Option<string>;
}


type DeckWithChildren = {
  readonly deck_id: number;
  readonly depth: number;
  readonly subdecks: ReadonlyArray<Deck>;
}

declare function listToTree(decks: ReadonlyArray<Deck>): ReadonlyArray<DeckWithChildren>
Was this page helpful?