-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
export const permix = createPermix<{
post: {
action: "read" | "create";
dataTypes: {
read: Post,
create: Omit<Post, "id">, // the database auto creates the id
};
};
}>();
We create a new property called dataTypes
(minor version upgrade).
Then in the check()
these types will be strongly typed for these actions.
Currently I have to rely on a partial object for all of the actions and this is annoying because I need to constantly reference my permissions to make sure i have the required properties on the object.
What is neat about this is if you need a compound datatype you can just pass a higher level object.
{post, user}
letstri
Metadata
Metadata
Assignees
Labels
No labels