godalming123 - Hi, I'm making a flashcards app ...
Hi, I'm making a flashcards app where you can create user defined flashcards, and each flashcard can depend on the contents of another flashcard.
Is it possible to force the dependencies to each be the key of an item in the
FlashcardDeck
map that is before the current item in the FlashcardDeck
map in order to prevent circular dependencies?Solution:Jump to solution
```ts
const FlashcardDeck = z.map(z.string(), z.object({
dependencies: z.array(z.string()),
contents: FormattedText,
})).refine((deck) => {...
2 Replies
I think that this code works:
Solution