To make all properties within a TypeScript interface optional, we can use the Partial type.
For instance, we write
interface Asset {
id: string;
internalId: string;
usage: number;
}
interface AssetDraft extends Partial<Asset> {}
to create the AssetDraft interface that inherits from Partial<Asset>.
Partial<Asset> is a type that makes the properties in the Asset interface optional.
Conclusion
To make all properties within a TypeScript interface optional, we can use the Partial type.