How do i make a property optional in a typescript interface?
Example:
interface Book {
title: string;
author?: string; // The '?' makes the property optional
}
const myBook: Book = {
title: 'Untitled'
};
In TypeScript, you can make a property in an interface optional by adding a '?' after its name.