---
title: "Discussion on \"TIL about typescript typing `as const`\" | Hashnode"
description: "Discussion on \"TIL about typescript typing `as const`\". I knew that typescript supports a type being a specific string, rather than the string type, so (for example) a function parameter can only receive the string “foo” and not a different string. Today I learnt that this can be done by using the as cons..."
url: "https://hashnode.com/posts/til-about-typescript-typing-as-const/697a0a7168d28da669363b08"
---

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

Discussion

# [TIL about typescript typing \`as const\`](https://techblog.timhilton.xyz/til-about-typescript-typing-as-const?utm_source=hashnode&utm_medium=feed)

I knew that typescript supports a type being a specific string, rather than the string type, so (for example) a function parameter can only receive the string “foo” and not a different string. Today I learnt that this can be done by using the as cons...

Jan 28 · 1 min read · techblog.timhilton.xyz  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)

## Written by

[Tim Hilton](https://hashnode.com/@tjhilton)

@tjhilton

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

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
