wasp/entities
Types for your app's Entities, which you can use on both the server and the client.
Wasp generates one type export per Entity, named after it (e.g. Task for
a Task model in your schema.prisma file). Each one is the type Prisma
generates for that model, so it describes the Entity's fields, except for
relation fields (e.g. it has userId, but not user). When you change an
Entity in your schema.prisma file, the type changes with it.
If your app uses auth, this module also exports the Auth and
AuthIdentity types for Wasp's
auth Entities.
They aren't part of Entity or EntityName.
Example
import { type Task } from "wasp/entities";
export function ExamplePage() {
const task: Task = {
id: "some-uuid-1234",
description: "Some random task",
isDone: false,
};
return <div>{task.description}</div>;
}
Type Aliases
Entity
Entity =
object
Any of your app's Entity types.
In your app, this is the union of the types of all the Entities you defined
in your schema.prisma file (e.g. User | Task).
EntityName
EntityName =
string
The name of any of your app's Entities.
In your app, this is the union of the names of all the Entities you defined
in your schema.prisma file (e.g. "User" | "Task").