DEV Community

Discussion on: 7 tips to improve your Typescript

Collapse
 
vyspiansky profile image
Ihor Vyspiansky

I like your article. Just want to add some clarity in the Required example.

Todo and Required<Todo> will behave quite similar considering your example? For instance, if you miss some property in the todoWithRequired object you will see the same type error.

However if you set some properties as optional in Todo type (let it be isFinished?: boolean or whatever), the different between Todo and Required<Todo> will be more clear, I guess. The object with type Todo will be OK without specifying these optional properties, but not Required<Todo>.