Usage Of Partial, Parameter And Keyof Keywords

Partial 

With this utility type, we can convert an object type and make all properties optional. One of the use cases is the model of a database entry with required fields. Updating such a record could have only optional fields.

Here’s an example,

Usage of Partial

You can see how the newPersonDetails shows an error as it is missing the required property email. But once we use the Partial type we can see that newpersonUpdate has only optional props. This approach allows you to create strict types first, with a loose definition later on.

Parameter 

In certain situations, it might be necessary to get hold of the parameter types of a function. There is a convenient utility type by the name Parameters which returns a tuple type of these parameters.

Usage of Partial Parameter and Keyof Keywords

Keyof 

Getting a full list of property names of an object type can be done with the keyof operator. This can be useful in many situations where you might need to process these keys.

In this example, firstname is causing a type error for obvious reasons

Usage of Partial Parameter and Keyof Keywords