---
title: "Comment by José Pablo Ramírez Vargas on \"How to Build and Publish an npm Package with TypeScript\" | Hashnode"
description: "It would have been nicer if the package had exported types."
url: "https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee"
---

[Discussion](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f)

Comment [How to Build and Publish an npm Package with TypeScript](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f)

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Nov 23, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee)

It would have been nicer if the package had exported types.

[Jan Škoruba](https://hashnode.com/@skoruba)

[Nov 23, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee#reply-6741fdb782949af4a5c5b39a)

The types are included in the package. If you run the command npm run build, the TypeScript types will be generated inside the dist/types folder. 🙂

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Nov 23, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee#reply-674222423193bbb2db46c3f6)

[Jan Škoruba](https://hashnode.com/@skoruba) yes, tsconfig.json sets declaration to true, but package.json doesn't specify the "types" property, or the more modern and preferred "exports" property. The types are there but package.json doesn't make it public.

[Jan Škoruba](https://hashnode.com/@skoruba)

[Nov 24, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee#reply-67434b9d055dc7c5dc3a40a4)

Hi [José Pablo Ramírez Vargas](https://hashnode.com/@webJose) - it is great suggestion, I will check it and update post. Thank you. 👍🏻 **Edit**: Already updated, thanks!

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Nov 24, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee#reply-674355bd3680bbe4482f3a97)

[Jan Škoruba](https://hashnode.com/@skoruba) great! One last detail. Don't think I'm bothering just for the sake of bothering. In "exports", the types always go first. If you were to run the publint package on your newly created package, you'll see the warning about this and the reason behind it. Other than that, I'd say well done.

[Jan Škoruba](https://hashnode.com/@skoruba)

[Nov 24, 2024](https://hashnode.com/posts/how-to-build-and-publish-an-npm-package-with-typescript/6740cbbe8f039c97fc6abe6f/comment/6741f96a51ad8d1756bb44ee#reply-6743673b2f7f6a91314eec10)

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose) - great tip, I updated it. Thank you for your valuable comments! 👌🏻
