Video – Partial Type in TypeScript

This video explains Partial Type in TypeScript.


interface IProduct {
    name: string;
    price: number;
}

function SaveProduct(product: Partial<IProduct>) {
    console.log(product.name);
    console.log(product.price);
}

SaveProduct({ name: "Laptop", price: 1000 });
SaveProduct({ name: "Mobile", price: 500 });
SaveProduct({ name: "Tablet"});

Discover more from Dhananjay Kumar

Subscribe to get the latest posts sent to your email.

Published by Dhananjay Kumar

Dhananjay Kumar is founder of NomadCoder and ng-India

Leave a comment

Discover more from Dhananjay Kumar

Subscribe now to keep reading and get access to the full archive.

Continue reading