---
title: "Discussion on \"Type-safe translations in TypeScript\" | Hashnode"
description: "Discussion on \"Type-safe translations in TypeScript\". As a developer, you may have encountered the need to internationalise your application. For that, you may either have used a library or written your own solution. In this article, we will explore how to create a type-safe translation system in TypeSc..."
url: "https://hashnode.com/posts/type-safe-translations-in-typescript/67973b671413b2be84dcf49b"
---

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

Discussion

# [Type-safe translations in TypeScript](https://brieuckaisin.hashnode.dev/type-safe-translations-in-typescript?utm_source=hashnode&utm_medium=feed)

As a developer, you may have encountered the need to internationalise your application. For that, you may either have used a library or written your own solution. In this article, we will explore how to create a type-safe translation system in TypeSc...

Jan 27, 2025 · 11 min read · brieuckaisin.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#type-level-programming](https://hashnode.com/tag/type-level-programming)
-   [#string-literals](https://hashnode.com/tag/string-literals)
-   [#i18n](https://hashnode.com/tag/i18n)
-   [#typesafety](https://hashnode.com/tag/typesafety)

## Written by

[Brieuc Kaisin](https://hashnode.com/@BrieucKaisin)

@BrieucKaisin · Belgium

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

Functional programming enthusiast, passionate Scala lover

## Responses 1

Markdown supported · ⌘↵ to post

[happyday](https://hashnode.com/@towday)

[Sep 4](https://hashnode.com/posts/type-safe-translations-in-typescript/67973b671413b2be84dcf49b/comment/6a9a200f57ff96b449256df4)

This is a thoughtful demonstration of how template-literal types can move an entire category of internationalization bugs from runtime to compile time. Inferring placeholders directly with `ExtractPlaceholders` is especially elegant: callers receive autocomplete for the required replacements, and a typo such as `namee` is rejected before it reaches production. I also appreciated that the article does not stop at a working implementation—the progression from the dummy version to proper inference makes the reasoning much easier to follow. The type-level accumulation of missing, unexpected, and duplicated placeholders is a particularly interesting exploration of TypeScript’s capabilities.

The next challenge would be connecting this approach to a real translation workflow. Translation files are often loaded from JSON or a localization platform, where literal types may be widened or the content may not be known until runtime. Combining compile-time inference for application code with schema validation during CI could preserve most of these guarantees. Pluralization, grammatical gender, rich-text placeholders, and ICU message syntax would also make excellent follow-up topics. The note about compiler performance is important too, because powerful recursive conditional types can become expensive in a large translation catalogue.
