---
title: "Comment by Krzysztof Szala on \"Typescript Best Practices #1 - Always prefer 'Type Declaration' over 'Type Assertion'\" | Hashnode"
description: "Type Assertion can be helpful in unit tests, when you need to create some typed object, but you don&#39;t need all its properties. Otherwise, I try to avoid it"
url: "https://hashnode.com/posts/typescript-best-practices-1-always-prefer-type-declaration-over-type-assertion/612f7c04c21ac123ca3775b7/comment/6130d3720aac045e01493850"
---

[Discussion](https://hashnode.com/posts/typescript-best-practices-1-always-prefer-type-declaration-over-type-assertion/612f7c04c21ac123ca3775b7)

Comment [Typescript Best Practices #1 - Always prefer 'Type Declaration' over 'Type Assertion'](https://hashnode.com/posts/typescript-best-practices-1-always-prefer-type-declaration-over-type-assertion/612f7c04c21ac123ca3775b7)

[Krzysztof Szala](https://hashnode.com/@AvantaR)

[Sep 2, 2021](https://hashnode.com/posts/typescript-best-practices-1-always-prefer-type-declaration-over-type-assertion/612f7c04c21ac123ca3775b7/comment/6130d3720aac045e01493850)

Type Assertion can be helpful in unit tests, when you need to create some typed object, but you don't need all its properties. Otherwise, I try to avoid it because it is almost like typing things with `any`.

[Harshit Jain](https://hashnode.com/@harshitjain)

[Sep 2, 2021](https://hashnode.com/posts/typescript-best-practices-1-always-prefer-type-declaration-over-type-assertion/612f7c04c21ac123ca3775b7/comment/6130d3720aac045e01493850#reply-6130d8a35a73ff5e27bc28c3)

Yes, that's also a common usecase 👍
