Skip to content

Get union type of type field (@@delegate) from table with Polymorphic Relations #1515

Answered by jiashengguo
piscopancer asked this question in Q&A
Discussion options

You must be logged in to vote

@piscopancer, firslty sorry for the late response, we didn't check the discussion that often. What you want should be achieved by this:

import type { Notification } from "@zenstackhq/runtime/prisma";

type NotificationType = Notification['type']

There is a post for a complete example of Polymorphic with more details:

https://zenstack.dev/blog/ocp

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by piscopancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants