---
title: "Discussion on \"Few Tips to prevent runtime errors in Typescript\" | Hashnode"
description: "Discussion on \"Few Tips to prevent runtime errors in Typescript\". #1 Prefer unknown over any\nSee this example on how any could go wrong.\nconst a: any = \"dhslkd\"\n\na.someMethod() // Runtime Error: a.someMethod is not a function\n\nOops! a does not have the someMethod but typescript doesn't care.\nLet's try the same but ..."
url: "https://hashnode.com/posts/few-tips-to-prevent-runtime-errors-in-typescript/61016714d3dd5634ae9082a4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Few Tips to prevent runtime errors in Typescript](https://arunmurugan.hashnode.dev/few-tips-to-prevent-runtime-errors-in-typescript?utm_source=hashnode&utm_medium=feed)

#1 Prefer unknown over any See this example on how any could go wrong. const a: any = "dhslkd" a.someMethod() // Runtime Error: a.someMethod is not a function Oops! a does not have the someMethod but typescript doesn't care. Let's try the same but ...

Jul 28, 2021 · 2 min read · arunmurugan.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Arun Murugan](https://hashnode.com/@arunmurugan)

@arunmurugan

  
[View profile](https://hashnode.com/@arunmurugan)

Solutions Consultant | Software Engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
