TypeScript Shape

Since we use TypeScript, let's define the shape of our data. For now, it will be just the Task shape that consists of a name and the done status.

Use the generate command to generate a shape scaffold for our Task:

kretes generate type Task

This will create app/types/index.ts with an empty Task interface :

export interface Task {
};

Let's adjust it to our use case by specifying two fields name and done. The done field has a question mark (?) at the end. This means it's an optional field.

export interface Task {
  name: string;
  done?: boolean
};

Found a mistake?