---
title: "Comment by Anıl Anar on \"In Defence of Typescript Enums\" | Hashnode"
description: "People use string literal enums because numeric enums are completely backwards. Arbitrary numbers can be assigned to enums types, even when they are out of rang"
url: "https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e"
---

[Discussion](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760)

Comment [In Defence of Typescript Enums](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760)

[Anıl Anar](https://hashnode.com/@anilanar)

[Apr 3, 2025](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e)

People use string literal enums because numeric enums are completely backwards. Arbitrary numbers can be assigned to enums types, even when they are out of range. So numeric enum type is nothing more than just a `number`. Did something change since then?

[Yazan Alaboudi](https://hashnode.com/@alaboudi)

[Apr 3, 2025](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e#reply-67ef1d272506b8ec200fb280)

In this article, I'm advocating to use enums in a way that makes the discussion of numeric vs string enums no longer relevant. If you use your enums symbolically, then you will never have issues

[Anıl Anar](https://hashnode.com/@anilanar)

[Apr 4, 2025](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e#reply-67efcfd53086d4b203ad73ed)

[Yazan Alaboudi](https://hashnode.com/@alaboudi)

Here's the issue that plagues only numeric enums, and not string enums:

```
enum Animal {
  Lion,
  Tiger,
}

const justANumber: number = 5;

// No type error
const myAnimal: Animal = justANumber;
```

Typescript made this historical error at some point and never tried to remedy it, let's say, by introducing a config such as `strictNumericEnums: boolean`.

[Yazan Alaboudi](https://hashnode.com/@alaboudi)

[Apr 4, 2025](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e#reply-67f01bb2561cf1b6c1e52049)

[Anıl Anar](https://hashnode.com/@anilanar) This is no longer an issue with the latest version of Typescript. It's been addressed.

[Anıl Anar](https://hashnode.com/@anilanar)

[Apr 4, 2025](https://hashnode.com/posts/in-defence-of-typescript-enums/67eae66767c03ec6e67a8760/comment/67eeef36454d36c3f4067d7e#reply-67f06158b166cbf815606e2e)

[Yazan Alaboudi](https://hashnode.com/@alaboudi)

Which version of Typescript?

[typescriptlang.org/play](https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250404#code/PTAEDsFcFsFMCcCWBjUsrQFDpqAguItAIYA2oA3pqKADKID24ANNaACqIDmCrAvpkzImAZwAuoAFaRxeAHIwARggBcEJQlABeUAFYA3IJCg5DUGICeAB1hp48BvCGiJ0CwSJk1HkuR3TZBWhleEMjMHEkcC40DGwMfEJfACZKNhp6Jm1QAHJSRnAc1hoaTh54bJyxbgQczAFncHEpGTE8AGUxKK41SMRo7IAiADMGBkVieEGw43ZrWwQHeABCRua3HzJk7ySt7IC2zu79IA)
